/* ==========================================================================
   "See what you can manage with Gigify": a phone in the middle, the four things you
   manage on either side. Pick one (or let it play) and the phone shows that screen,
   which you can tap. js/manage.js switches panes and runs the small demos.
   Everything is drawn here: no screenshots are used or implied.
   ========================================================================== */

.mg {
  --mg-ease: cubic-bezier(0.3, 1.5, 0.5, 1);
  display: grid;
  gap: var(--space-5);
  align-items: center;
}

.mg-side {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---- The four things ------------------------------------------------------- */
.mg-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 5.5rem;
  padding: var(--space-4);
  overflow: hidden;
  border: 2px solid var(--gg-line);
  border-radius: var(--radius-lg);
  background: var(--gg-white);
  color: var(--gg-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.35s ease, translate 0.4s var(--mg-ease);
}

.mg-tab__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--gg-tint);
  color: var(--gg-green-deep);
  transition: background-color 0.3s ease, color 0.3s ease, rotate 0.5s var(--mg-ease);
}

.mg-tab__icon .icon {
  width: 1.4rem;
  height: 1.4rem;
}

.mg-tab__text {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.mg-tab__text strong {
  font-size: 1.125rem;
  line-height: 1.15;
}

.mg-tab__text span {
  font-size: var(--fs-small);
  color: var(--gg-text-muted);
  transition: color 0.3s ease;
}

.mg-tab__no {
  position: absolute;
  right: var(--space-3);
  bottom: -0.35rem;
  font-size: 3rem;
  font-weight: var(--fw-heavy);
  line-height: 1;
  letter-spacing: -0.04em;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 2px rgba(24, 37, 27, 0.12);
  pointer-events: none;
  transition: -webkit-text-stroke-color 0.3s ease;
}

.mg-tab:hover {
  border-color: var(--gg-ink);
  translate: 0 -3px;
}

.mg-tab.is-on {
  border-color: var(--gg-ink);
  background: var(--gg-ink);
  color: var(--gg-white);
  --color-focus: var(--gg-green);
  box-shadow: 0 18px 36px rgba(24, 37, 27, 0.2);
}

.mg-tab.is-on .mg-tab__icon {
  background: var(--gg-green);
  color: var(--gg-ink);
  rotate: -8deg;
}

.mg-tab.is-on .mg-tab__text span {
  color: #D5DDD7;
}

.mg-tab.is-on .mg-tab__no {
  -webkit-text-stroke-color: rgba(81, 186, 108, 0.6);
}

/* progress while it plays by itself */
.mg-tab::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  width: 100%;
  background: var(--gg-green);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.mg.is-playing .mg-tab.is-on::after {
  animation: mg-bar var(--mg-interval, 4500ms) linear forwards;
}

@keyframes mg-bar {
  to { transform: scaleX(1); }
}

/* ---- The phone ------------------------------------------------------------------ */
.mg-phone {
  position: relative;
  justify-self: center;
  width: min(100%, 17.5rem);
  aspect-ratio: 9 / 15.5;
  padding: 0.7rem;
  border-radius: 2.4rem;
  background: var(--gg-ink);
  box-shadow: 0 30px 60px rgba(24, 37, 27, 0.28), 0 0 0 2px rgba(24, 37, 27, 0.9);
  rotate: calc(var(--mgx, 0) * 2deg);
  transition: rotate 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mg-phone::before {
  content: "";
  position: absolute;
  inset: -1.25rem;
  z-index: -1;
  border-radius: 3.5rem;
  background: radial-gradient(circle at 50% 40%, rgba(81, 186, 108, 0.45), transparent 68%);
}

.mg-phone__notch {
  position: absolute;
  left: 50%;
  top: 0.95rem;
  z-index: 3;
  width: 4.5rem;
  height: 1.1rem;
  translate: -50% 0;
  border-radius: var(--radius-pill);
  background: var(--gg-ink);
}

.mg-screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 1.8rem;
  background: var(--gg-white);
}

.mg-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 1.9rem 1rem 0.6rem;
  background: var(--gg-tint);
  font-size: 0.8rem;
  font-weight: var(--fw-heavy);
}

.mg-top__logo img {
  width: 1.1rem;
  height: auto;
}

.mg-top__live {
  margin-left: auto;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--gg-ink);
  color: var(--gg-green);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mg-pane {
  position: absolute;
  inset: 3.4rem 0 0;
  display: grid;
  align-content: start;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  opacity: 0;
  translate: 0 14px;
  scale: 0.98;
  visibility: hidden;
  transition: opacity 0.35s ease, translate 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), scale 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s 0.5s;
}

.mg-pane.is-on {
  opacity: 1;
  translate: 0 0;
  scale: 1;
  visibility: visible;
  transition-delay: 0.08s, 0.08s, 0.08s, 0s;
}

/* little pieces used inside the screens */
.mg-av {
  display: block;
  flex: none;
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  overflow: hidden;
  border-radius: 50%;
}

.mg-av::before,
.mg-av::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
}

.mg-av::before { left: 31%; top: 18%; width: 38%; height: 38%; border-radius: 50%; }
.mg-av::after { left: 16%; top: 58%; width: 68%; height: 60%; border-radius: 50% 50% 0 0; }
.mg-av--a { background: linear-gradient(135deg, #51BA6C, #1F7A45); }
.mg-av--b { background: linear-gradient(135deg, #FF9A5C, #FF6B8B); }
.mg-av--c { background: linear-gradient(135deg, #5CB8FF, #1B6091); }
.mg-av--lg { width: 3.25rem; height: 3.25rem; }

.mg-lines {
  flex: 1;
  display: grid;
  gap: 0.4rem;
}

.mg-lines i {
  display: block;
  height: 0.5rem;
  border-radius: 99px;
  background: #E3E6E8;
}

.mg-lines i:first-child { width: 75%; background: #CDD1D5; }
.mg-lines i:last-child { width: 50%; }
.mg-lines--wide i { width: 100%; }
.mg-lines--wide i:nth-child(2) { width: 85%; }
.mg-lines--wide i:nth-child(3) { width: 60%; }

.mg-profile {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.mg-pill {
  justify-self: start;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--gg-tint);
  color: var(--gg-green-deep);
  font-size: 0.75rem;
  font-weight: var(--fw-heavy);
}

.mg-block {
  padding: 0.7rem;
  border-radius: 12px;
  background: #F4F6F5;
}

.mg-block--row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.mg-badge {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--gg-green);
}

.mg-btn {
  justify-self: stretch;
  padding: 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--gg-ink);
  color: var(--gg-white);
  font-size: 0.75rem;
  font-weight: var(--fw-heavy);
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.mg-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: var(--fw-heavy);
}

.mg-note {
  margin: 0;
  font-size: 0.8rem;
  font-weight: var(--fw-bold);
  color: var(--gg-green-deep);
}

.mg-note span {
  display: inline-block;
  min-width: 1ch;
  font-size: 1.1rem;
  font-weight: var(--fw-heavy);
  color: var(--gg-ink);
}

.mg-note.is-bump span {
  animation: mg-bump 0.4s var(--mg-ease);
}

@keyframes mg-bump {
  0% { scale: 1.6; color: var(--gg-green); }
  100% { scale: 1; }
}

/* services */
.mg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mg-chip {
  min-height: 2.25rem;
  padding: 0 0.8rem;
  border: 2px solid var(--gg-line);
  border-radius: var(--radius-pill);
  background: var(--gg-white);
  color: var(--gg-ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: var(--fw-heavy);
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, scale 0.35s var(--mg-ease);
}

.mg-chip.is-on {
  border-color: var(--gg-ink);
  background: var(--gg-ink);
  color: var(--gg-white);
  scale: 1.04;
}

/* availability */
.mg-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
}

.mg-day {
  aspect-ratio: 1;
  min-height: 2rem;
  padding: 0;
  border: 2px solid var(--gg-line);
  border-radius: 10px;
  background: var(--gg-white);
  color: var(--gg-ink);
  font: inherit;
  font-size: 0.75rem;
  font-weight: var(--fw-heavy);
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, scale 0.35s var(--mg-ease);
}

.mg-day.is-on {
  border-color: var(--gg-ink);
  background: var(--gg-ink);
  color: var(--gg-green);
  scale: 1.05;
}

.mg-slots {
  display: grid;
  gap: 0.35rem;
}

.mg-slots span {
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  background: #F4F6F5;
  font-size: 0.8rem;
  font-weight: var(--fw-bold);
  color: var(--gg-text-muted);
}

.mg-slots span.is-on {
  background: var(--gg-tint);
  color: var(--gg-ink);
  box-shadow: inset 3px 0 0 var(--gg-green);
}

/* bookings */
.mg-reqs {
  display: grid;
  gap: 0.5rem;
}

.mg-req {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.6rem;
  border-radius: 14px;
  background: #F4F6F5;
}

.mg-accept {
  flex: none;
  position: relative;
  min-width: 4.6rem;
  min-height: 2.25rem;
  padding: 0 0.7rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--gg-ink);
  color: var(--gg-white);
  font: inherit;
  font-size: 0.7rem;
  font-weight: var(--fw-heavy);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, scale 0.35s var(--mg-ease);
}

.mg-accept span:last-child {
  display: none;
}

.mg-accept.is-done {
  background: var(--gg-green);
  color: var(--gg-ink);
  scale: 1.05;
}

.mg-accept.is-done span:first-child {
  display: none;
}

.mg-accept.is-done span:last-child {
  display: inline;
}

/* ---- Layout ----------------------------------------------------------------------- */
@media (min-width: 1024px) {
  .mg {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: var(--space-6);
  }

  .mg-side {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  /* the phone shrinks with short windows so the pinned section always fits */
  .mg-phone {
    width: clamp(12rem, calc((100vh - 22rem) * 0.58), 18.5rem);
  }

  /* a short line joins each card to the phone */
  .mg-side--l .mg-tab::before,
  .mg-side--r .mg-tab::before {
    content: "";
    position: absolute;
    top: 50%;
    width: var(--space-6);
    height: 0;
    border-top: 2px dashed rgba(24, 37, 27, 0.35);
  }

  .mg-side--l .mg-tab::before { left: 100%; }
  .mg-side--r .mg-tab::before { right: 100%; }

  .mg-side .mg-tab { overflow: visible; }
  .mg-tab::after { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

  .mg-side--l li:nth-child(1) { translate: 1.5rem 0; }
  .mg-side--l li:nth-child(2) { translate: -0.5rem 0; }
  .mg-side--r li:nth-child(1) { translate: 0.5rem 0; }
  .mg-side--r li:nth-child(2) { translate: -1.5rem 0; }
}

/* phones: the four cards sit in a 2 x 2 grid above the phone */
@media (max-width: 1023.98px) {
  .mg {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
  }

  .mg-side {
    display: contents;
  }

  .mg-phone {
    grid-column: 1 / -1;
    order: 5;
    margin-top: var(--space-2);
    width: clamp(12.5rem, calc((100vh - 31rem) * 0.58), 16rem);
    aspect-ratio: 9 / 15.5;
  }

  .mg--pin .mg-side--l .mg-tab,
  .mg--pin .mg-side--r .mg-tab {
    translate: none;
  }
}

@media (max-width: 639.98px) {
  .mg-tab {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    min-height: 0;
    padding: var(--space-3);
  }

  .mg-tab__text strong {
    font-size: 1rem;
  }

  .mg-tab__text span {
    display: none;
  }

  .mg-tab__no {
    font-size: 2.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mg *,
  .mg *::before,
  .mg *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---- Desktop, pinned: the scroll walks through the four screens (js/manage.js sets
   --t, --sub on .mg and --k on each card) ------------------------------------------- */
.mg-runway--pin {
  height: 320vh;
}

.mg-pin--on {
  position: sticky;
  top: calc(var(--header-h) + 0.5rem);
}

.mg-pin--on .section-head {
  margin-bottom: var(--space-4);
}

.mg--pin .mg-tab {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.35s ease;
}

/* cards lean towards the phone as they become the current one, the phone drifts and tilts */
.mg--pin .mg-side--l .mg-tab {
  translate: calc(var(--k, 0) * 14px) 0;
}

.mg--pin .mg-side--r .mg-tab {
  translate: calc(var(--k, 0) * -14px) 0;
}

.mg--pin .mg-phone {
  translate: 0 calc(var(--sub, 0) * -16px);
  rotate: calc((var(--t, 0) - 1.5) * 1.6deg + var(--mgx, 0) * 2deg);
  transition: none;
}

.mg--pin .mg-pane,
.mg--pin .mg-pane.is-on {
  visibility: visible;
  opacity: var(--o, 0);
  translate: 0 calc(var(--d, 0) * -56px);
  scale: calc(1 - var(--d, 0) * var(--d, 0) * 0.04);
  transition: none;
}

/* layered parallax inside the screen: each piece drifts at its own speed */
.mg--pin .mg-pane > :nth-child(1) { translate: 0 calc(var(--d, 0) * -6px); }
.mg--pin .mg-pane > :nth-child(2) { translate: 0 calc(var(--d, 0) * -16px); }
.mg--pin .mg-pane > :nth-child(3) { translate: 0 calc(var(--d, 0) * -28px); }
.mg--pin .mg-pane > :nth-child(4) { translate: 0 calc(var(--d, 0) * -40px); }
.mg--pin .mg-pane > :nth-child(5) { translate: 0 calc(var(--d, 0) * -52px); }

@media (prefers-reduced-motion: reduce) {
  .mg--pin .mg-tab,
  .mg--pin .mg-phone {
    translate: none;
    rotate: none;
  }
}

@media (max-width: 1023.98px) {
  .mg--pin .mg-side--l .mg-tab,
  .mg--pin .mg-side--r .mg-tab {
    translate: none;
  }
}

@media (max-width: 1023.98px) {
  .mg-pin--on {
    top: calc(var(--header-h) + 1.75rem);
  }
}
