/* =========================
   CHECKERBOARD
   ========================= */

   .checkerboard {
    height: 180px;
  
    background-color: var(--checker-black);
    background-image:
      linear-gradient(45deg, var(--checker-blue) 25%, transparent 25%),
      linear-gradient(-45deg, var(--checker-blue) 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, var(--checker-blue) 75%),
      linear-gradient(-45deg, transparent 75%, var(--checker-blue) 75%);
  
    background-size: 120px 120px;
    background-position: 0 0, 0 60px, 60px -60px, -60px 0;
  }
  
  
  /* =========================
     SEGMENTED CONTROL
     ========================= */
  
  .work-tabs-sticky {
    width: max-content;
    margin: 0 auto 34px;
    z-index: 60;
  
    /*
      Important:
      no extra padding/background/border here.
      The wrapper keeps exactly the same size in both tabs,
      so the pill does not jump when switching.
    */
  }
  
  /* Sticky only when Other / Posters is active */
  .work.is-other-active .work-tabs-sticky {
    position: sticky;
    top: 116px;
    z-index: 60;
  
    transition: top 300ms ease;
  }
  
  /* Keep it sticky while we animate/scroll back to Projects */
  .work.is-returning-to-projects .work-tabs-sticky {
    position: sticky;
    top: 116px;
    z-index: 60;
  
    transition: top 300ms ease;
  }
  
  /* Header is 100px and hides on scroll-down */
  body.header-is-hidden .work.is-other-active .work-tabs-sticky,
  body.header-is-hidden .work.is-returning-to-projects .work-tabs-sticky {
    top: 16px;
  }
  
  
  .segmented {
    --indicator-x: 3px;
    --indicator-width: 0px;
    --indicator-scale-x: 1;
    --indicator-scale-y: 1;
    --indicator-origin: 50% 50%;

    position: relative;
    isolation: isolate;

    width: max-content;
    margin: 0 auto;

    padding: 3px;

    display: flex;

    background: #ddd6cc;
    border-radius: 999px;

    /* The outer pill acts like rigid walls. */
    overflow: hidden;
  }


  /*
    Red pill.
    At rest it is exactly the same clean pill as before.
    Only while moving does JS stretch/squash it.
  */
  .segmented::before {
    content: "";

    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 0;

    width: var(--indicator-width);

    background: var(--red);
    border-radius: 999px;

    transform:
      translateX(var(--indicator-x))
      scaleX(var(--indicator-scale-x))
      scaleY(var(--indicator-scale-y));

    transform-origin: var(--indicator-origin);

    transition:
      transform 440ms cubic-bezier(0.18, 0.84, 0.22, 1),
      width 440ms cubic-bezier(0.18, 0.84, 0.22, 1);

    z-index: 0;
    pointer-events: none;

    will-change: transform;
  }


  /*
    Fast liquid motion.

    The outer .segmented pill is the rigid container.
    On impact the blob gets taller than the inside of the pill;
    overflow:hidden clips it so it appears to smear up/down
    along the wall instead of passing through it.
  */
  .segmented.is-liquid-moving::before {
    animation:
      pill-blob-travel 440ms cubic-bezier(0.18, 0.84, 0.22, 1)
      both;
  }

  /* Moving RIGHT: flatten/spread against the RIGHT wall. */
  .segmented.is-impact-right::before {
    border-radius:
      78% 2% 2% 78% /
      50% 3% 3% 50%;
  }

  /* Moving LEFT: mirror the same slime splat. */
  .segmented.is-impact-left::before {
    border-radius:
      2% 78% 78% 2% /
      3% 50% 50% 3%;
  }



  /*
    Extra impact smear:
    this is the part that makes the hit feel like slime filling
    the rounded wall while the trailing mass catches up.
  */
  .segmented::after {
    content: "";

    position: absolute;
    top: 3px;
    bottom: 3px;

    width: 30px;

    background: var(--red);
    opacity: 0;

    z-index: 0;
    pointer-events: none;

    transform: scaleX(0.35) scaleY(0.55);
    will-change: transform, opacity;
  }

  .segmented.is-impact-right::after {
    right: 3px;

    border-radius:
      0 999px 999px 0;

    transform-origin: 100% 50%;

    animation:
      slime-wall-right 150ms cubic-bezier(0.12, 0.86, 0.22, 1)
      both;
  }

  .segmented.is-impact-left::after {
    left: 3px;

    border-radius:
      999px 0 0 999px;

    transform-origin: 0% 50%;

    animation:
      slime-wall-left 150ms cubic-bezier(0.12, 0.86, 0.22, 1)
      both;
  }


  @keyframes slime-wall-right {
    0% {
      opacity: 0;
      transform:
        translateX(8px)
        scaleX(0.25)
        scaleY(0.45);
    }

    36% {
      opacity: 1;
      transform:
        translateX(0)
        scaleX(1.35)
        scaleY(1.12);
    }

    68% {
      opacity: 1;
      transform:
        translateX(0)
        scaleX(1.62)
        scaleY(1.34);
    }

    100% {
      opacity: 0;
      transform:
        translateX(-5px)
        scaleX(0.72)
        scaleY(0.92);
    }
  }


  @keyframes slime-wall-left {
    0% {
      opacity: 0;
      transform:
        translateX(-8px)
        scaleX(0.25)
        scaleY(0.45);
    }

    36% {
      opacity: 1;
      transform:
        translateX(0)
        scaleX(1.35)
        scaleY(1.12);
    }

    68% {
      opacity: 1;
      transform:
        translateX(0)
        scaleX(1.62)
        scaleY(1.34);
    }

    100% {
      opacity: 0;
      transform:
        translateX(5px)
        scaleX(0.72)
        scaleY(0.92);
    }
  }


  @keyframes pill-blob-travel {
    0% {
      border-radius: 999px;
    }

    20% {
      border-radius:
        60% 40% 56% 44% /
        48% 52% 48% 52%;
    }

    46% {
      border-radius:
        66% 34% 62% 38% /
        45% 55% 45% 55%;
    }

    68% {
      border-radius:
        44% 56% 48% 52% /
        52% 48% 52% 48%;
    }

    84% {
      border-radius:
        54% 46% 52% 48% /
        49% 51% 49% 51%;
    }

    100% {
      border-radius: 999px;
    }
  }

  .segment {
    appearance: none;

    position: relative;
    z-index: 1;

    border: 0;
    border-radius: 999px;

    padding: 10px 18px;

    background: transparent;
    color: var(--ink);

    font-size: 14px;
    font-weight: 500;

    cursor: pointer;

    transition:
      color 220ms ease,
      opacity 220ms ease;
  }


  .segment.is-active {
    color: #f7f3ec;
    background: transparent;
  }


  /* =========================
     WORK PANEL TRANSITION
     ========================= */
  
  .work-inner {
    overflow: visible;
  }
  
  .work-panels {
    width: 100%;
    overflow: visible;
  }
  
  .work-panel {
    width: 100%;
    overflow: visible;
  }
  
  .work-panel.is-transitioning {
    will-change: transform, opacity;
  }
  
  
  /* =========================
     PROJECT CARDS
     ========================= */
  
  .project-list {
    display: grid;
    gap: 30px;
    overflow: visible;
  }
  
  
  .project-card {
    position: relative;
  
    width: 100%;
    max-width: 1142px;
    height: 600px;
  
    margin-inline: auto;
  
    overflow: hidden;
  
    border: 1px solid rgba(46, 46, 46, 0.08);
    border-radius: 24px;
  
    box-shadow:
      0 2px 6px rgba(46, 46, 46, 0.04),
      0 12px 32px rgba(46, 46, 46, 0.08);
  
    isolation: isolate;
  
    background: #e8e0d4;
  
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  
    color: var(--ink);
  
    cursor: pointer;
  
    transition:
      transform 400ms cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 400ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  
  
  .project-card::before {
    content: "";
  
    position: absolute;
    inset: 0;
  
    z-index: -2;
  
    background-image: var(--project-background);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
  
    pointer-events: none;
  }
  
  .project-card::after {
    content: "";
  
    position: absolute;
    inset: 0;
  
    z-index: -1;
  
    pointer-events: none;
  
    background:
      radial-gradient(
        circle at 50% 42%,
        rgba(255, 255, 255, 0.10),
        transparent 52%
      );
  
    opacity: 0;
  
    transition:
      opacity 500ms ease;
  }
  
  .project-card--orange {
    --project-background: url("../bilder/startsida/shoe-haven/yellow.svg");
  }
  
  .project-card--purple {
    --project-background: url("../bilder/startsida/robot/purple.svg");
  }
  
  .project-card--blue {
    --project-background: url("../bilder/startsida/howlkraul/blue.svg");
  }
  
  .project-card--red {
    --project-background: url("../bilder/startsida/savier/red.svg");
  }
  
  
  .project-visual {
    width: min(420px, 45%);
    margin: 0 0 22px;
  
    transition:
      transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  
  
  .project-visual img {
    width: 100%;
    max-height: 280px;
  
    object-fit: contain;
  }
  
  
  .project-copy {
    width: 100%;
    text-align: center;
  }
  
  
  .project-copy h2 {
    margin: 0 0 8px;
  
    font-size: 17px;
    font-weight: 500;
  }
  
  
  .project-copy p {
    margin: 0;
  
    font-size: 14px;
    font-weight: 500;
  }
  
  
  /* =========================
     SEE MORE BUTTON
     ========================= */
  
  .card-button {
    position: absolute;
    right: 16px;
    bottom: 16px;
  
    width: 112px;
    height: 36px;
  
    padding: 0;
  
    border: 1px solid var(--line);
    border-radius: 18px;
  
    background: #f7f3ec;
    color: var(--ink);
  
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
  
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
  
    overflow: hidden;
  
    transition:
      transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
      background-color 260ms ease;
  }
  
  
  /* Hide the old HTML arrow */
  .card-button span {
    display: none;
  }
  
  
  /* No shine layer — hover uses a subtle liquid wobble instead. */
  .card-button::before {
    content: none;
  }

  .card-button::after {
    content: "";
  
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
  
    background-image: url("../bilder/startsida/arrow.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
  
    transition:
      transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  
  @keyframes card-button-liquid-wobble {
    0% {
      transform: translateY(0) scaleX(1) scaleY(1);
      border-radius: 18px;
    }

    24% {
      transform: translateY(-1px) scaleX(1.035) scaleY(0.965);
      border-radius: 16px 20px 17px 19px;
    }

    48% {
      transform: translateY(-1px) scaleX(0.985) scaleY(1.025);
      border-radius: 20px 16px 19px 17px;
    }

    72% {
      transform: translateY(-1px) scaleX(1.015) scaleY(0.99);
      border-radius: 17px 19px 16px 20px;
    }

    100% {
      transform: translateY(-1px) scaleX(1) scaleY(1);
      border-radius: 18px;
    }
  }


  @keyframes card-button-idle-wobble {
    0%,
    100% {
      transform: translateY(-1px) scaleX(1) scaleY(1);
      border-radius: 18px;
    }

    25% {
      transform: translateY(-1px) scaleX(1.006) scaleY(0.996);
      border-radius: 17.5px 18.5px 18px 18px;
    }

    50% {
      transform: translateY(-1px) scaleX(0.997) scaleY(1.004);
      border-radius: 18.5px 17.5px 18px 18px;
    }

    75% {
      transform: translateY(-1px) scaleX(1.004) scaleY(0.998);
      border-radius: 18px 18px 17.5px 18.5px;
    }
  }


  @keyframes card-arrow-wobble {
    0% {
      transform: translateX(0) rotate(0deg);
    }

    35% {
      transform: translateX(3px) rotate(3deg);
    }

    65% {
      transform: translateX(1px) rotate(-2deg);
    }

    100% {
      transform: translateX(2px) rotate(0deg);
    }
  }


  @media (hover: hover) and (pointer: fine) {
    .project-card:hover {
      transform: translateY(-3px);

      box-shadow:
        0 4px 10px rgba(46, 46, 46, 0.05),
        0 18px 42px rgba(46, 46, 46, 0.10);
    }

    .project-card:hover::after {
      opacity: 1;
    }

    .project-card:hover .project-visual {
      transform: translateY(-6px) scale(1.01);
    }

    .card-button:hover {
      animation:
        card-button-liquid-wobble
          420ms
          cubic-bezier(0.22, 1, 0.36, 1)
          both,
        card-button-idle-wobble
          1800ms
          420ms
          ease-in-out
          infinite;
    }

    .card-button:hover::after {
      animation:
        card-arrow-wobble
        420ms
        cubic-bezier(0.22, 1, 0.36, 1)
        both;
    }
  }



/* =========================
   PROJECT IMAGE GALLERY
   Reusable on every project page
   ========================= */

.project-gallery {
  --gallery-max-width: 520px;
  --gallery-main-height: 310px;
  --gallery-thumb-height: 96px;
  --gallery-thumb-width: 132px;
  --gallery-gap: 12px;

  width: 100%;
  min-width: 0;
}

.project-gallery-main {
  width: min(var(--gallery-max-width), 100%);
  height: var(--gallery-main-height);

  margin-inline: auto;

  display: flex;
  align-items: center;
  justify-content: center;
}

.project-gallery-main img {
  width: 100%;
  height: 100%;

  display: block;

  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;

  object-fit: contain;

  transition:
    opacity 180ms ease,
    transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.project-gallery-main.is-changing img {
  opacity: 0;
  transform: scale(0.99);
}

.project-gallery-thumbnails {
  width: min(var(--gallery-max-width), 100%);

  margin: 48px auto 0;
  padding: 2px 2px 10px;

  display: flex;
  gap: var(--gallery-gap);

  overflow-x: auto;
  overflow-y: hidden;

  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;

  scrollbar-width: thin;
  scrollbar-color: rgba(46, 46, 46, 0.24) transparent;
}

.project-gallery-thumbnails::-webkit-scrollbar {
  height: 5px;
}

.project-gallery-thumbnails::-webkit-scrollbar-track {
  background: transparent;
}

.project-gallery-thumbnails::-webkit-scrollbar-thumb {
  background: rgba(46, 46, 46, 0.22);
  border-radius: 999px;
}

.project-gallery-thumb {
  appearance: none;

  flex: 0 0 var(--gallery-thumb-width);
  height: var(--gallery-thumb-height);

  position: relative;

  padding: 6px;

  border: 0 !important;
  border-radius: 0;

  outline: 0 !important;
  box-shadow: none !important;

  background: transparent;

  cursor: pointer;

  scroll-snap-align: start;

  transition:
    opacity 220ms ease,
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.project-gallery-thumb img {
  width: 100%;
  height: 100%;

  display: block;

  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;

  object-fit: contain;

  pointer-events: none;
}

.project-gallery-thumb::after {
  content: "";

  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;

  height: 2px;

  border-radius: 999px;

  background: var(--red);

  opacity: 0;
  transform: scaleX(0.45);

  transition:
    opacity 220ms ease,
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.project-gallery-thumb.is-selected::after {
  opacity: 1;
  transform: scaleX(1);
}

.project-gallery-thumb:focus,
.project-gallery-thumb:focus-visible {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

@media (hover: hover) and (pointer: fine) {
  .project-gallery-thumb:not(.is-selected):hover {
    opacity: 0.72;
    transform: translateY(-2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-gallery-thumbnails {
    scroll-behavior: auto;
  }

  .project-gallery-main img,
  .project-gallery-thumb {
    transition: none;
  }
}

@media (max-width: 600px) {
  .project-gallery {
    --gallery-main-height: 190px;
    --gallery-thumb-height: 82px;
    --gallery-thumb-width: 112px;
    --gallery-gap: 10px;
  }

  .project-gallery-thumbnails {
    width: 100%;

    margin-top: 32px;
    padding-bottom: 8px;
  }

  .project-gallery-thumb {
    padding: 6px;
  }
}


  /* =========================
     CONTACT LINKS
     ========================= */
  
  .contact-link {
    display: flex !important;
    align-items: center;
    gap: 8px;
  }
  
  
  .contact-link img {
    width: 24px;
    height: 24px;
  
    object-fit: contain;
  }
  
  
  /* =========================
     REDUCED MOTION
     ========================= */
  
  @media (prefers-reduced-motion: reduce) {
    .segmented::before,
    .segment,
    .work.is-other-active .work-tabs-sticky,
    .work.is-returning-to-projects .work-tabs-sticky,
    .project-card,
    .project-card::before,
    .project-card::after,
    .project-visual,
    .card-button,
    .card-button::after {
      transition: none;
    }
  
    .card-button,
    .card-button::after,
    .segmented.is-liquid-moving::before {
      animation: none;
    }
  }
  
  
  /* =========================
     MOBILE
     ========================= */
  
  @media (max-width: 600px) {
  
    .checkerboard {
      height: 170px;
  
      background-size: 112px 112px;
      background-position:
        0 0,
        0 56px,
        56px -56px,
        -56px 0;
    }
  
  
    .work-tabs-sticky {
      margin-top: 14px;
      margin-bottom: 28px;
    }
  
  
    .segmented {
      margin-top: 0;
    }
  
  
    .segment {
      padding: 8px 15px;
  
      /* Always 14px, also on mobile */
      font-size: 14px;
      font-weight: 500;
    }
  
  
    .project-list {
      gap: 10px;
    }
  
  
    .project-card {
      width: calc(100% - 16px);
      max-width: 377px;
      height: 600px;
  
      padding: 50px 16px 84px;
  
      border-radius: 24px;
    }
  
  
    .project-visual {
      width: 72%;
      max-width: 270px;
  
      margin-bottom: 20px;
    }
  
  
    .project-visual img {
      max-height: 260px;
    }
  
  
    .project-copy {
      text-align: center;
    }
  
  
    .project-copy h2 {
      font-size: 17px;
      font-weight: 500;
    }
  
  
    .project-copy p {
      font-size: 14px;
      font-weight: 500;
    }
  
  
    .card-button {
      left: 16px;
      right: 16px;
      bottom: 16px;
  
      width: auto;
      height: 52px;
      min-height: 0;
  
      padding: 0;
  
      border: 1px solid var(--line);
      border-radius: 18px;
  
      background: #f7f3ec;
  
      justify-content: center;
  
      font-size: 14px;
      font-weight: 500;
    }
  
  
    .card-button::after {
      width: 16px;
      height: 16px;
      flex-basis: 16px;
    }
  }
  