:root {
  --height--chrome-tab: 40px;
  --height--chrome-top: 60px;
  --height--max-chrome-buffer-top: max(10vh, calc(var(--height--chrome-tab) * 1.5));
  
  --color-ribbon-1: rgb(67, 134, 245);
  --color-ribbon-2: rgb(234, 67, 54);
  --color-ribbon-3: rgb(251, 188, 6);
  --color-ribbon-4: rgb(52, 168, 84);
  --color--opaque-gray: rgba(0, 0, 0, 0.6);

  --box-shadow--normal: 0 2px 4px rgba(0, 0, 0, 0.2);

  --border-radius--slight: 2px;

  --rotation--pix: -2deg;
}

body {
  font-family: var(--font-family--sans-serif);
  overflow-x: hidden;
  background: var(--color--body-bg);
}

main {
  display: block;
  min-height: 100vh;
}

.mobile-only {
  display: none;
  min-height: 100vh;
  width: 90%;
}

.shameless-plug {
  position: fixed;
  bottom: 0rem;
  left: 1rem;
  z-index: 10;
  align-items: center;
  display: flex;
  animation: shamelessPlugMovement 5s ease-in-out 1.5s infinite;

  img {
    opacity: 0;
    width: 60px;      
    height: 60px;     
    border-radius: 50%; 
    object-fit: cover;  
    border: solid 2px #000;
    animation: 
      wigglePlug 3s infinite linear,
      popPlugImage 0.4s ease-in-out 5s forwards;
    z-index: 1;
  }

  a {
    opacity: 0;
    background: #000;
    border-radius: var(--border-radius--slight);
    color: #fff;
    padding: 0.4rem 1.2rem;
    font-size: 0.8rem;
    letter-spacing: -0.05rem;
    font-weight: 600;
    animation: 
      wigglePlug 5s infinite linear,
      popPlugText 0.3s ease-out 5.3s forwards;
    text-decoration: none;
    margin: 0 0 50px -10px;
  }
}

h1 {
  font-family: var(--font-family--display);
  font-size: 10rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.8rem;
  text-decoration: underline;
  text-decoration-thickness: 0.5rem;
  text-underline-offset: 10px;
  margin-bottom: 1.2rem;
  text-shadow: var(--box-shadow--normal);
}

h2 {
  font-size: 1.2rem;
  letter-spacing: -0.05rem;
  font-weight: 900;
  line-height: 1.5;
  margin-bottom: 2rem;

  span {
    display: inline-block;
    color: #fff;
    padding: 0.4rem 1.2rem;
    rotate: var(--rotation--pix);
    margin-left: -0.5rem;
    position: relative;
    border-radius: var(--border-radius--slight);
    border-top-right-radius: 0;
    border-top-left-radius: 0;

    &:not(:last-child)::after {
      content: '';
      position: absolute;
      right: -3px;
      top: -2px;
      width: 6px;
      height: 100%;
      background: rgba(0,0,0,0.3);
      clip-path: polygon(0 20%, 100% 0%, 100% 50%);
      z-index: 1;
      rotate: -4deg;
    }

    &:nth-child(1) {
      background: linear-gradient(135deg, var(--color-ribbon-1) 78%, oklch(from var(--color-ribbon-1) calc(l * 0.7) c h) 100%);
      clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 8px 50%);
      padding-left: 1.5rem;
    }

    &:nth-child(2) {
      background: linear-gradient(135deg, var(--color-ribbon-2) 78%, oklch(from var(--color-ribbon-2) calc(l * 0.8) c h) 100%);
      clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }

    &:nth-child(3) {
      color: #222;
      background: linear-gradient(135deg, var(--color-ribbon-3) 78%, oklch(from var(--color-ribbon-3) calc(l * 0.9) c h) 100%);
      clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }

    &:nth-child(4) {
      background: var(--color-ribbon-4);
      clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 50%, 100% 100%, 0 100%);
      padding-right: 1.5rem;
    }
  }
}

p {
  margin-bottom: 1rem;
  font-size: 1.4rem;
  letter-spacing: -0.01rem;
  width: 700px;
  text-align: center;
  text-wrap: balance;

  strong {
    font-weight: 900;
    letter-spacing: -0.025rem;
  }
}

.pix {
  font-family: var(--font-family--display);
  font-weight: 900;
  color: inherit;
  font-size: 120%; 
  letter-spacing: -0.1rem;
  text-decoration: underline;
  text-decoration-thickness: 0.1rem;
}

.key {
  font-weight: 400 !important;
  border-radius: var(--border-radius--keyboard);
  background: var(--background--07-mac);
  box-shadow: var(--box-shadow--07-mac);
  border: var(--border--07-mac);
  letter-spacing: 0;
  padding: 0.2rem 0.8rem;
  text-transform: uppercase;
  color: rgba(0,0,0,0.7);
}

.callout {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  rotate: var(--rotation--pix);
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: -0.05rem;
  cursor: pointer;
  opacity: 0;
  animation: calloutBounce 0.3s ease-out 1.5s forwards;
  transition: all 0.2s ease;

  &:hover {
    scale: 1.1;
  }
  
  span { 
    border: solid 3px #000;
    padding: 0.2rem 0.8rem;
    border-radius: var(--border-radius--rounded);
  }

  img {
    z-index: 2;
    margin-top: -3px;
  }
}

.hero-section {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;

  .copy {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateY(20px);
    animation: heroBounce 0.3s ease-in-out 1.5s forwards;
  }
}

/* Scrollable section */
.scroll-section {
  position: relative;
  margin-top: calc(100vh - var(--height--chrome-top));
  min-height: 100vh;
  z-index: 2;
}

.chrome-container {
  width: 800px;
  height: 400px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  position: sticky;
  margin: 0 auto;
  top: var(--height--max-chrome-buffer-top);

  .chrome-extend-edges {
    container-type: size;

    &::before {
      content: '';
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      width: 100vw;
      height: 101cqh;
      background: var(--color--chrome-bg);
      border-top-right-radius: 8px;
      border-top-left-radius: 8px;
      z-index: -1;
    }
  }

  &.popup-opened {
    .chrome-tab, .chrome-top, .chrome-bookmark-bar {
      opacity: 0.5;
    }
  }

  .chrome-tab {
    position: absolute;
    top: -40px;
    left: 0;
    height: var(--height--chrome-tab);
    display: flex;
    align-items: center;
    gap: 8px;
    background:rgb(253, 248, 255);
    padding: 8px 10px 8px 12px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    max-width: 280px;
    margin-left: 0;
    cursor: pointer;

    .chrome-tab-side {
      background: var(--color--chrome-bg);
      width: 100vw;
      height: 10px;
      top: 30px;
      position: absolute;

      &::before {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100vw;
        height: var(--height--chrome-tab);
        background: linear-gradient(to bottom, transparent, var(--color--body-bg) 50%);
      }

      &.left {
        left: -100vw;
        &::before { border-bottom-right-radius: 12px; }
      }

      &.right {
        right: -100vw;
        &::before { border-bottom-left-radius: 12px; }
      }
    }

    .tab-favicon {
      flex-shrink: 0;
      width: 16px;
      height: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .tab-title {
      flex: 1;
      font-size: 13px;
      color: rgba(0, 0, 0, 0.8);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .tab-close {
      width: 20px;
      height: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      border: none;
      border-radius: 50%;
      cursor: pointer;
      color: var(--color--opaque-gray);
      padding: 0;
    }
  }

  .chrome-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    height: var(--height--chrome-top);
    background: var(--color--chrome-bg);

    .fake-address-bar {
      flex: 1;
      background: linear-gradient(90deg, rgb(253, 248, 255) 0%, rgb(236, 233, 243) 20%);
      height: 36px;
      display: flex;
      align-items: center;
      padding-left: 10px;
      font-size: 14px;
      color: var(--color--opaque-gray);
      border-top-right-radius: var(--border-radius--rounded);
      border-bottom-right-radius: var(--border-radius--rounded);
    }

    .chrome-extension-callout {
      position: relative;
      animation: pulsate 2s ease-in-out infinite;
      
      img {
        cursor: pointer;
        height: 50px;
        margin-top: 4px;
      }

      &::before {
        content: '';
        position: absolute;
        left: 10px;
        top: 28px;
        transform: translateY(-50%);
        width: 76px;
        height: 36px;
        border-radius: var(--border-radius--rounded);
        border: solid 1px rgba(0, 0, 0, 0.1);
        opacity: 0;
        transition: opacity 0.2s ease;
        pointer-events: none;
      }
    
      &:hover::before {
        background-color: rgba(0, 0, 0, 0.06);
        opacity: 1;
      }

      /* Arrow pointer */
      &::after {
        content: url("data:image/svg+xml,%3Csvg fill='rgba(0,0,0,1)' xmlns='http://www.w3.org/2000/svg' width='47' height='91'%3E%3Cpath fill='rgba(0,0,0,1)' fill-rule='evenodd' d='M27.482 80.594a445.563 445.563 0 01-1.887-9.411c-2.417-12.917-3.045-25.978-2.997-39.092.02-5.112.107-10.224.16-15.336.046-4.489.288-8.966.91-13.419.087-.62.147-1.245.174-1.869.022-.512-.661-.934-1.178-.77-1.214.381-2.017 1.184-2.34 2.399-.184.69-.286 1.41-.341 2.123-.214 2.682-.44 5.365-.574 8.051-.182 3.673-.287 7.35-.421 11.025-.44 12.032.095 24.027 1.225 36 .481 5.09 1.19 10.148 2.058 15.185a7.5 7.5 0 01.088.794.385.385 0 01-.086.231c-.14.186-.313.202-.47.035a72.875 72.875 0 01-5.879-6.987c-2.661-3.609-5.41-7.147-8.348-10.536a108.468 108.468 0 00-3.264-3.573 6.412 6.412 0 00-1.259-1c-.4-.248-.869-.206-1.291.01-.85.437-1.386 1.143-1.636 2.045-.12.436-.085.901.19 1.29.206.29.434.577.697.816 3.141 2.85 5.75 6.16 8.258 9.548a214.043 214.043 0 008.505 10.753c1.788 2.117 3.33 4.443 4.973 6.681.902 1.229 1.782 2.473 2.678 3.705.21.287.431.571.68.827.413.426 1.274.466 1.742.1.649-.51 1.18-1.11 1.456-1.903.059-.17.118-.342.143-.519.634-4.493 3.132-8.166 5.285-12.003 1.288-2.294 3.107-4.172 4.642-6.271.369-.505.834-.942 1.273-1.392 1.57-1.607 3.154-3.198 4.715-4.811.443-.458.783-.991.77-1.671-.008-.373-.118-.695-.418-.943-.382-.317-.816-.369-1.261-.208a2.09 2.09 0 00-.686.417 77.065 77.065 0 00-2.346 2.231c-.7.7-1.322 1.479-2.053 2.144-1.205 1.098-2.186 2.377-3.227 3.619-2.62 3.126-4.595 6.657-6.647 10.144-.365.62-.717 1.247-1.099 1.856-.086.138-.362.328-.398.3-.187-.146-.455-.327-.516-.615'/%3E%3C/svg%3E");
        position: absolute;
        left: 32px;
        bottom: -25px;
        transform: translateY(-100%);
        rotate: 225deg;
        opacity: 0;
        animation: arrowToPixBounce 0.2s ease-in-out 1.2s forwards;
      }

      &.clicked::after {
        display: none;
      }
    }
  }

  .chrome-bookmark-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    height: 48px;
    background: var(--color--chrome-bg);

    .folder-nav {
      display: flex;
      gap: 20px;
      align-items: center;
    }

    .folder-item {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      transition: opacity 0.2s;
    }

    .folder-icon {
      color: var(--color--opaque-gray);
    }

    .folder-name {
      font-size: 0.8rem;
      letter-spacing: -0.01rem;
      color: var(--color--opaque-gray);
      white-space: nowrap;
    }
  }

  /* Override positioning for popup demo */
  .popup {
    top: 43px;
    position: absolute;
    display: none;
    margin-right: 40px;
    width: 670px;
    background: var(--color--chrome-bg);
    border: 1px solid var(--color--chrome-border);
    box-shadow: var(--box-shadow--normal);
    z-index: 1000;
  }

  .chrome-body {
    width: 100%;
    height: 100%;
    position: relative;

    &::before {
      content: '';
      position: absolute;
      left: 50%;
      background: radial-gradient(circle at 0% 0%, lch(57.28% 63.69 284.14) 0%, lch(53.8% 77.25 35.36) 33.33333333333333%, lch(80.25% 82 82.84) 66.66666666666666%, lch(61.11% 60.97 146.03) 100%);
      transform: translateX(-50%);
      width: 100vw;
      height: 100vh;
      z-index: -1;
    }
  }
}

/* Tutorial Checklist */
.tutorial-checklist {
  position: absolute;
  top: 1.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;

  ul {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    justify-content: center;

    li {
      display: block;
      gap: 1rem;
      color: #fff;
      padding: 0.8rem 1.2rem;
      rotate: var(--rotation--pix);
      margin-left: -0.5rem;
      border-radius: var(--border-radius--slight);
      white-space: nowrap;
      background: linear-gradient(15deg, rgb(0, 0, 0) 0%, transparent 70%);
      font-size: 1.2rem;
      letter-spacing: -0.02rem;
      font-weight: 700;
      color: #fff;
      line-height: 1.1;
      text-wrap: nowrap;
      opacity: 0.5;

      --start-rotation: 0deg;
      --rotation-increment: -1deg;
      --margin-left--increment: 8px;
      --margin-left--exponential: 1.5;

      &:nth-child(1) { margin-left: calc((var(--margin-left--increment) * 0)); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 0)); }
      &:nth-child(2) { margin-left: calc((var(--margin-left--increment) * pow(1, var(--margin-left--exponential)))); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 1)); }
      &:nth-child(3) { margin-left: calc((var(--margin-left--increment) * pow(2, var(--margin-left--exponential)))); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 2)); }
      &:nth-child(4) { margin-left: calc((var(--margin-left--increment) * pow(3, var(--margin-left--exponential)))); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 3)); }
      &:nth-child(5) { margin-left: calc((var(--margin-left--increment) * pow(4, var(--margin-left--exponential)))); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 4)); }
      &:nth-child(6) { margin-left: calc((var(--margin-left--increment) * pow(5, var(--margin-left--exponential)))); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 5)); }
      &:nth-child(7) { margin-left: calc((var(--margin-left--increment) * pow(6, var(--margin-left--exponential)))); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 6)); }
      &:nth-child(8) { margin-left: calc((var(--margin-left--increment) * pow(7, var(--margin-left--exponential)))); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 7)); }
      &:nth-child(9) { margin-left: calc((var(--margin-left--increment) * pow(8, var(--margin-left--exponential)))); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 8)); }
      &:nth-child(10) { margin-left: calc((var(--margin-left--increment) * pow(9, var(--margin-left--exponential)))); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 9)); }
      &:nth-child(11) { margin-left: calc((var(--margin-left--increment) * pow(10, var(--margin-left--exponential)))); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 10)); }
      &:nth-child(12) { margin-left: calc((var(--margin-left--increment) * pow(11, var(--margin-left--exponential)))); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 11)); }
      &:nth-child(13) { margin-left: calc((var(--margin-left--increment) * pow(12, var(--margin-left--exponential)))); rotate: calc(var(--start-rotation) + (var(--rotation-increment) * 12)); }

      &.completed {
        opacity: 1;
        background: linear-gradient(15deg, rgba(0, 145, 0, 0.3) 0%, transparent 70%);
        scale: 0.85;
      }

      &.recompleted {
        animation: tutorialReCompletedBounce 0.3s ease-in-out !important;
      }

      &:not(.completed) {
        animation: tutorialNextStepBounce 0.4s ease-in-out 0.8s forwards;

        /* For all sibling <li> elements that come after it and are also incomplete, turn off the animation. */
        ~ li:not(.completed) {
          animation: none;
        }
      }

      .hint {
        font-weight: 400;
        font-size: 80%;
      }

      a {
        color: inherit;
      }

      .completed-note {
        position: absolute;
        background: green;
        box-shadow: var(--box-shadow--normal);
        top: 50%;
        transform: translate(calc(-100% - 20px), -50%);
        left: 0;
        rotate: -1deg;
        padding: 0.4rem;
        border-radius: var(--border-radius--slight);
        animation: completedNoteBounce 0.3s ease-in-out;
      }
    }
  }
}

.tutorial-arrow {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1000;
  color: #000;

  &.visible {
    transition: left 0.3s ease-out, top 0.3s ease-out, opacity 0.3s ease-out;
    transition-delay: 1s;
    opacity: 1;
  }
}

.clipboard-log {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  z-index: 9999;

  .clipboard-log-item {
    background-color: #fff;
    border-radius: var(--border-radius--slight);
    padding: 1rem;
    font-weight: 600;
    color: #000;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transition: all 0.3s ease;
    animation: clipboardSlideIn 5s ease forwards;
    min-width: 240px;
    max-width: 240px;
    text-align: center;
    white-space: pre-wrap;
    position: relative; 
    box-shadow: 1px 1px 8px 0px rgba(0,0,0,0.2);

    .clipboard-log-swatch {
      width: 100%;
      border: solid 1px rgba(0,0,0,0.1);
      border-radius: var(--border-radius--slight);
      aspect-ratio: 10/4;
    }

    .clipboard-log-text {
      flex: 1;
      line-height: 1.2;
    }
  }
}

/* Animations */

@keyframes wigglePlug {
  0% { rotate: 0; }
  50% { rotate: -5deg; }
  100% { rotate: 0; }
}

@keyframes popPlugText {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  70% {
    opacity: 1;
    transform: scale(1.04);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes popPlugImage {
  0% {
    opacity: 0;
    transform: scale(0) rotate(20deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.2) rotate(-5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(-5deg);
  }
}

@keyframes heroBounce {
  0% {
    transform: translateY(20px) rotate(0deg);
  }
  70% {
    transform: translateY(-10px) rotate(0.5deg);
  }
  100% {
    transform: translateY(-5px) rotate(0deg);
  }
}

@keyframes calloutBounce {
  0% {
    transform: translateX(20px) translateY(50%) rotate(-20deg) scale(0.9);
    opacity: 0;
  }
  70% {
    transform: translateY(-10%);
    opacity: 1;
  }
  100% {
    transform:  translateY(0%);
    opacity: 1;
  }
}

@keyframes shamelessPlugMovement {
  0% {
    transform: translateX(0) translateY(0);
  }
  50% {
    transform: translateX(-5px) translateY(10px);
  }
  100% {
    transform: translateX(0) translateY(0);
  }
}

@keyframes arrowToPixBounce {
  0% {
    transform: translateX(20px) translateY(-150%) scale(0.5);
    opacity: 0;
  }
  70% {
    transform: translateX(0px) translateY(-100%) scale(0.9);
    opacity: 1;
  }
  100% {
    transform: translateX(0px) translateY(-100%) scale(0.8);
    opacity: 1;
  }
}

@keyframes tutorialNextStepBounce {
  0% {
    transform: translateY(0);
    opacity: 0.5;
  }
  100% {
    transform: translateY(-5%) scale(1.25);
    opacity: 1;
  }
}

@keyframes tutorialReCompletedBounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05) translateY(-3px);
  }
}

@keyframes fadeOutUp {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

@keyframes completedNoteBounce {
  0% {
    transform: scale(0.5) translate(calc(-100% - 20px), -50%);
  }
  50% {
    transform: scale(1.1) translate(calc(-100% - 20px), -60%);
  }
  100% {
    transform: scale(1) translate(calc(-100% - 20px), -50%);
  }
}

@keyframes clipboardSlideIn {
  0% {
    opacity: 0;
    rotate: 20deg;
    transform: translateX(100%);
  }
  5% { /* 0.4s / 3.4s */
    opacity: calc(1 - (var(--index) * 0.2));
    rotate: 2deg;
    transform: translateX(0);
  }
  95% { /* 3s / 3.4s - hold visible state */
    opacity: 1;
    rotate: 2deg;
    transform: translateX(0);
  }
  100% { /* 3s / 3.4s - hold visible state */
    opacity: 0;
    transform: translateX(100%);
    rotate: 20deg;
  }
}

/* Mobile hide */
@media screen and (max-width: 1023px) {
  main {
    display: none;
  }

  .hero-section {
    width: 100%;
    height: 100vh;
    align-items: center;
    padding: 0 5%;
    animation: none;
  }

  p {
    width: auto;
  }

  .mobile-only {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }
}
