/* MacTidy — mactidy.dev: the moving parts.
   The hero tour plays the real app (screenshots of MacTidy itself) with a cursor, highlights and notes on top;
   the iPhone section plays Tidy Swipe as it works in Tidyup. Everything stops for prefers-reduced-motion. */

/* ---------- Hero tour ---------- */

.tour-stage { padding-bottom: clamp(48px, 6vw, 88px); }
.tour-stage .tour-tabs { padding-left: clamp(0px, 9%, 120px); }
@media (max-width: 760px) { .tour-stage .tour-tabs { padding-left: 0; } }

.tour {
  position: relative;
  max-width: var(--wide);
  margin: 0 auto;
}

.tour-screen {
  position: relative;
  aspect-ratio: 1372 / 806;
  border-radius: clamp(8px, 1.2vw, 14px);
  overflow: hidden;
  background: #101a2b;
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.18),
    0 50px 110px -24px rgba(0, 0, 0, 0.7),
    0 18px 36px -18px rgba(0, 0, 0, 0.6);
  isolation: isolate;
}

.tour-shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.012);
  transition: opacity 700ms var(--ease);
}
.tour-shot.is-on { opacity: 1; }
.tour-shot.is-on.drift { animation: tour-drift 7s linear forwards; }
@keyframes tour-drift { from { transform: scale(1.0); } to { transform: scale(1.045); } }

/* A highlight ring drawn around the part of the screen the note is about */
.tour-ring {
  position: absolute;
  z-index: 2;
  border-radius: 12px;
  box-shadow: 0 0 0 2px var(--mint-bright), 0 0 0 7px color-mix(in srgb, var(--mint-bright) 28%, transparent), 0 0 40px 4px color-mix(in srgb, var(--mint-bright) 30%, transparent);
  opacity: 0;
  transition: left 650ms var(--ease), top 650ms var(--ease), width 650ms var(--ease), height 650ms var(--ease), opacity 350ms ease;
  pointer-events: none;
}
.tour-ring.is-on { opacity: 1; animation: ring-breathe 1.8s ease-in-out infinite; }
@keyframes ring-breathe {
  50% { box-shadow: 0 0 0 2px var(--mint-bright), 0 0 0 10px color-mix(in srgb, var(--mint-bright) 18%, transparent), 0 0 48px 8px color-mix(in srgb, var(--mint-bright) 26%, transparent); }
}

/* The pointer: the Mac's own arrow */
.tour-cursor {
  position: absolute;
  z-index: 5;
  left: 60%;
  top: 60%;
  width: clamp(14px, 1.7vw, 24px);
  transform: translate(-12%, -6%);
  transition: left 950ms cubic-bezier(.55, .05, .25, 1), top 950ms cubic-bezier(.55, .05, .25, 1);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}
.tour-cursor svg { width: 100%; height: auto; transition: transform 140ms ease; }
.tour-cursor.press svg { transform: scale(0.82); }

.tour-ripple {
  position: absolute;
  z-index: 4;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  border: 2px solid #fff;
  opacity: 0;
  pointer-events: none;
}
.tour-ripple.go { animation: ripple 620ms ease-out; }
@keyframes ripple {
  from { opacity: 0.9; transform: scale(0.2); }
  to { opacity: 0; transform: scale(1.6); }
}

/* Ticks drawn into Clean Up's checkboxes as the pointer clicks them */
.tour-tick {
  position: absolute;
  z-index: 3;
  width: 1.05%;
  aspect-ratio: 1;
  margin: -0.5% 0 0 -0.52%;
  border-radius: 22%;
  background: var(--mint-bright);
  display: grid;
  place-items: center;
  transform: scale(0);
  transition: transform 260ms cubic-bezier(.3, 1.6, .5, 1);
}
.tour-tick.is-on { transform: scale(1); }
.tour-tick svg { width: 76%; }

/* Typing into Search: a patch the colour of the field covers the text, then the words appear */
.tour-type {
  position: absolute;
  z-index: 3;
  left: 17.2%;
  top: 11.7%;
  width: 26%;
  height: 2.5%;
  background: #2a303f;
  color: #e7edf4;
  font: 500 clamp(6px, 0.96vw, 13px)/1 var(--font);
  display: flex;
  align-items: center;
  padding-left: 0.2%;
  opacity: 0;
  white-space: pre;
}
.tour-type.is-on { opacity: 1; }
.tour-type::after {
  content: "";
  width: 1px;
  height: 1.1em;
  margin-left: 1px;
  background: #7aa7ff;
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* The note that pops up beside what was clicked */
.tour-note {
  position: absolute;
  z-index: 6;
  max-width: min(46%, 340px);
  padding: 10px 14px 11px;
  border-radius: 14px;
  background: rgba(250, 252, 255, 0.96);
  color: #13233a;
  font-size: clamp(0.75rem, 1.15vw, 0.9375rem);
  line-height: 1.32;
  letter-spacing: -0.01em;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.55), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transform-origin: top left;
  transition: opacity 260ms ease, transform 420ms cubic-bezier(.3, 1.4, .5, 1);
  pointer-events: none;
}
.tour-note.is-on { opacity: 1; transform: none; }
.tour-note strong { display: block; font-size: 1.12em; letter-spacing: -0.018em; margin-bottom: 2px; color: #1f8a5b; }

/* Scene tabs under the window, each with its own progress bar */
.tour-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: clamp(20px, 2.4vw, 28px) auto 0;
  padding: 0;
  list-style: none;
}
.tour-tabs button {
  position: relative;
  min-width: 112px;
  padding: 9px 16px 13px;
  border: 0;
  border-radius: 12px;
  background: color-mix(in srgb, #fff 6%, transparent);
  color: var(--on-navy-2);
  font: 500 0.875rem/1.2 var(--font);
  letter-spacing: -0.01em;
  cursor: pointer;
  overflow: hidden;
  transition: background 200ms ease, color 200ms ease;
}
.tour-tabs button:hover { background: color-mix(in srgb, #fff 11%, transparent); color: var(--on-navy); }
.tour-tabs button[aria-selected="true"] { background: color-mix(in srgb, var(--mint-bright) 18%, transparent); color: #fff; }
.tour-tabs button i {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background: color-mix(in srgb, #fff 12%, transparent);
  overflow: hidden;
}
.tour-tabs button i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--mint-bright);
  transform: scaleX(0);
  transform-origin: left;
}
.tour-tabs button.done i::after { transform: scaleX(1); }
.tour-tabs button[aria-selected="true"] i::after { animation: tab-fill var(--scene-ms, 7000ms) linear forwards; }
.tour.paused .tour-tabs button[aria-selected="true"] i::after { animation-play-state: paused; }
@keyframes tab-fill { to { transform: scaleX(1); } }

.tour-foot {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  color: var(--on-navy-2);
  font-size: 0.875rem;
}
.tour-foot p { margin: 0; text-align: center; }
.tour-pause {
  flex: none;
  min-height: 28px;
  padding: 3px 12px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, #fff 9%, transparent);
  color: var(--on-navy);
  font: 500 0.8125rem/1 var(--font);
  cursor: pointer;
}
.tour-pause:hover { background: color-mix(in srgb, #fff 15%, transparent); }

/* Tidyup on iPhone, leaning in at the corner of the hero */
.tour-phone {
  position: absolute;
  z-index: 8;
  left: -3%;
  bottom: -7%;
  width: clamp(104px, 13%, 170px);
  animation: phone-float 6s ease-in-out infinite;
}
.tour-phone a { display: block; text-decoration: none; color: var(--on-navy); }
.tour-phone .phone { box-shadow: 0 40px 70px -20px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.12); }
.tour-phone span {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--on-navy-2);
}
@keyframes phone-float { 50% { transform: translateY(-10px) rotate(-1deg); } }
@media (max-width: 760px) { .tour-phone { display: none; } }
@media (max-width: 620px) {
  .tour-note { max-width: 62%; padding: 6px 9px 7px; border-radius: 10px; }
  .tour-tabs button { min-width: 0; padding: 7px 11px 11px; font-size: 0.8125rem; }
}

/* ---------- A phone, drawn in CSS ---------- */

.phone {
  position: relative;
  aspect-ratio: 1320 / 2868;
  border-radius: 15% / 7%;
  padding: 3.2%;
  background: linear-gradient(150deg, #2b3340, #0c1018 60%, #1d2430);
  box-shadow: 0 30px 60px -24px rgba(19, 35, 58, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.phone > img, .phone > .phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 12.5% / 5.8%;
  object-fit: cover;
  overflow: hidden;
}
.phone > img { display: block; }

/* ---------- Tidyup for iPhone ---------- */

.iphone-section { overflow: hidden; }
.iphone-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: center;
}
@media (max-width: 900px) { .iphone-grid { grid-template-columns: 1fr; } }

.iphone-copy .eyebrow {
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--mint);
  letter-spacing: -0.01em;
}
.iphone-copy h2 { margin-bottom: 20px; }
.iphone-copy > p { color: var(--ink-2); font-size: clamp(1.0625rem, 1.5vw, 1.25rem); line-height: 1.45; }
.iphone-points { margin: 28px 0 32px; padding: 0; list-style: none; display: grid; gap: 16px; }
.iphone-points li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; align-items: start; }
.iphone-points b { display: block; font-weight: 600; letter-spacing: -0.014em; }
.iphone-points span { color: var(--ink-2); font-size: 0.975rem; }
.iphone-points i {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-style: normal;
  background: var(--safe-tint);
  color: var(--mint);
}
.iphone-points i svg { width: 22px; height: 22px; }
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 20px 8px 16px;
  border-radius: 14px;
  background: #000;
  color: #fff;
  text-decoration: none;
  line-height: 1.1;
}
.store-badge:hover { text-decoration: none; background: #1b1b1b; }
.store-badge svg { width: 26px; height: 26px; }
.store-badge small { display: block; font-size: 0.6875rem; opacity: 0.85; }
.store-badge strong { display: block; font-size: 1.1875rem; font-weight: 600; letter-spacing: -0.02em; }
.iphone-price { margin: 14px 0 0; font-size: 0.9375rem; color: var(--ink-3); }

/* The swipe demo: Tidy Swipe as the app draws it */
.swipe-demo-wrap { position: relative; display: flex; justify-content: center; }
.swipe-demo-wrap::before {
  content: "";
  position: absolute;
  inset: 8% -10%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--mint-bright) 28%, transparent), transparent);
  filter: blur(10px);
  z-index: 0;
}
.swipe-demo { position: relative; z-index: 1; width: min(330px, 78vw); }

.sw {
  --sw-bg: #eef2f5;
  --sw-ink: #13233a;
  --sw-ink-2: #5d6d82;
  --sw-red: #e5484d;
  --sw-green: #1f7a52;
  position: relative;
  background: var(--sw-bg);
  color: var(--sw-ink);
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  padding: 13% 6% 4%;
  container-type: inline-size;
}
.sw-status {
  position: absolute;
  top: 3.2%;
  left: 13%;
  right: 9%;
  display: flex;
  justify-content: space-between;
  font: 600 4.6cqw/1 var(--font);
}
.sw-island {
  position: absolute;
  top: 2.4%;
  left: 50%;
  width: 29%;
  height: 3.6%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #000;
}
.sw-top { display: flex; align-items: center; justify-content: space-between; margin-top: 2%; }
.sw-pill {
  min-width: 18cqw;
  padding: 2.6cqw 4cqw;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(19, 35, 58, 0.12), 0 0 0 0.5px rgba(19, 35, 58, 0.08);
  font: 600 4.4cqw/1 var(--font);
  text-align: center;
}
.sw-pill.done { color: var(--sw-green); }
.sw-pill.bin { color: var(--sw-red); display: flex; gap: 1.6cqw; align-items: center; justify-content: center; }
.sw-pill.bin svg { width: 4.6cqw; height: 4.6cqw; }
.sw-pill.bin b { display: inline-block; min-width: 2.2ch; text-align: left; }
.sw-pill.bin.bump b { animation: bump 380ms cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bump { 40% { transform: scale(1.5); } }
.sw-title { font: 600 4.8cqw/1 var(--font); }
.sw-progress { margin: 6cqw 0 2cqw; height: 1.3cqw; border-radius: 9cqw; background: #d6dde6; overflow: hidden; }
.sw-progress i { display: block; height: 100%; width: 0; background: var(--sw-green); border-radius: inherit; transition: width 400ms var(--ease); }
.sw-counts { display: flex; justify-content: space-between; font: 500 3.6cqw/1.2 var(--font); color: var(--sw-ink-2); }
.sw-counts .del { color: var(--sw-red); }

.sw-deck { position: relative; flex: 1; margin: 5cqw 0 4cqw; }
.sw-card {
  position: absolute;
  inset: 0;
  border-radius: 7cqw;
  overflow: hidden;
  background: #ccc;
  box-shadow: 0 10px 26px -10px rgba(19, 35, 58, 0.45);
  transform-origin: 50% 110%;
  will-change: transform;
}
.sw-card .photo { position: absolute; inset: 0; }
.sw-card .date {
  position: absolute;
  left: 5cqw;
  bottom: 5cqw;
  padding: 1.6cqw 3.2cqw;
  border-radius: 999px;
  background: rgba(40, 40, 40, 0.42);
  color: #fff;
  font: 600 3.4cqw/1 var(--font);
  backdrop-filter: blur(6px);
}
.sw-card .stamp {
  position: absolute;
  top: 7cqw;
  padding: 1.8cqw 3.4cqw;
  border: 0.9cqw solid currentColor;
  border-radius: 3cqw;
  font: 800 6.4cqw/1 var(--font);
  letter-spacing: 0.04em;
  opacity: 0;
  background: rgba(255, 255, 255, 0.75);
}
.sw-card .stamp.del { right: 6cqw; color: var(--sw-red); transform: rotate(12deg); }
.sw-card .stamp.keep { left: 6cqw; color: var(--sw-green); transform: rotate(-12deg); }

.sw-buttons { display: flex; justify-content: center; align-items: center; gap: 7cqw; margin-bottom: 5cqw; }
.sw-btn {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(19, 35, 58, 0.12);
  transition: transform 160ms ease;
}
.sw-btn.big { width: 17cqw; height: 17cqw; }
.sw-btn.small { width: 12cqw; height: 12cqw; color: #7c8aa0; }
.sw-btn.del { color: var(--sw-red); box-shadow: 0 0 0 0.7cqw #f7c9cb, 0 2px 6px rgba(19, 35, 58, 0.12); }
.sw-btn.keep { color: var(--sw-green); box-shadow: 0 0 0 0.7cqw #c4dfd1, 0 2px 6px rgba(19, 35, 58, 0.12); }
.sw-btn svg { width: 44%; height: 44%; }
.sw-btn.press { transform: scale(0.86); }

/* The final review sheet that slides up when the deck is done */
.sw-review {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: var(--sw-bg);
  padding: 15% 6% 6%;
  transform: translateY(102%);
  transition: transform 520ms cubic-bezier(.2, .8, .2, 1);
  display: flex;
  flex-direction: column;
}
.sw-review.is-on { transform: none; }
.sw-review h4 { margin: 0; font: 700 7.2cqw/1.1 var(--font); letter-spacing: -0.02em; }
.sw-review p { margin: 2cqw 0 5cqw; font: 400 3.8cqw/1.35 var(--font); color: var(--sw-ink-2); }
.sw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2cqw; }
.sw-grid div { position: relative; aspect-ratio: 1; border-radius: 3cqw; overflow: hidden; }
.sw-grid div::after {
  content: "";
  position: absolute;
  right: 2cqw;
  top: 2cqw;
  width: 5.4cqw;
  height: 5.4cqw;
  border-radius: 50%;
  background: var(--sw-red) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.4 3.4L15 7' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
  box-shadow: 0 0 0 0.6cqw #fff;
}
.sw-grid div.kept { opacity: 0.4; }
.sw-grid div.kept::after { background: #fff; box-shadow: 0 0 0 0.5cqw #9aa7b8 inset; }
.sw-review .note { margin-top: auto; text-align: center; font: 500 3.4cqw/1.3 var(--font); color: var(--sw-ink-2); }
.sw-delete {
  margin-top: 3cqw;
  padding: 4cqw;
  border-radius: 999px;
  background: var(--sw-red);
  color: #fff;
  font: 600 4.4cqw/1 var(--font);
  text-align: center;
  transition: transform 160ms ease;
}
.sw-delete.press { transform: scale(0.95); }
.sw-confirm {
  position: absolute;
  left: 13%;
  right: 13%;
  top: 38%;
  z-index: 6;
  padding: 5cqw 4cqw 0;
  border-radius: 5cqw;
  background: rgba(245, 246, 248, 0.97);
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.45);
  text-align: center;
  font: 400 3.4cqw/1.3 var(--font);
  opacity: 0;
  transform: scale(1.1);
  transition: opacity 200ms ease, transform 260ms ease;
}
.sw-confirm.is-on { opacity: 1; transform: none; }
.sw-confirm b { display: block; font: 600 3.8cqw/1.3 var(--font); margin-bottom: 1.4cqw; }
.sw-confirm div { display: flex; margin-top: 4cqw; border-top: 1px solid #d0d5dc; }
.sw-confirm div span { flex: 1; padding: 3.2cqw 0; color: #2f6fed; font-size: 3.8cqw; }
.sw-confirm div span + span { border-left: 1px solid #d0d5dc; color: var(--sw-red); font-weight: 600; }

/* The hand that does the swiping */
.sw-hand {
  position: absolute;
  z-index: 9;
  width: 15%;
  left: 50%;
  top: 60%;
  opacity: 0;
  transition: opacity 250ms ease;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}
.sw-hand.is-on { opacity: 1; }

/* Real Tidyup screens, fanned out */
.iphone-shots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 2.4vw, 32px);
  margin-top: clamp(64px, 8vw, 112px);
}
.iphone-shots figure { margin: 0; }
.iphone-shots figcaption { margin-top: 14px; text-align: center; font-size: 0.9375rem; color: var(--ink-2); }
.iphone-shots figcaption b { display: block; color: var(--ink); font-weight: 600; }
@media (max-width: 820px) {
  .iphone-shots { grid-template-columns: repeat(4, 62%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; }
  .iphone-shots figure { scroll-snap-align: center; }
}

/* ---------- Reveal on scroll ---------- */

.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity 800ms var(--ease), transform 900ms var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
.iphone-shots > .reveal:nth-child(2) { transition-delay: 90ms; }
.iphone-shots > .reveal:nth-child(3) { transition-delay: 180ms; }
.iphone-shots > .reveal:nth-child(4) { transition-delay: 270ms; }

/* ---------- Try the disk map ---------- */

.try-head { text-align: center; color: var(--on-navy); margin: 0 auto clamp(32px, 4vw, 56px); max-width: 46rem; }
.try-head h2 { margin: 0 auto; }
.try-head p { margin: 16px auto 0; color: var(--on-navy-2); font-size: clamp(1.0625rem, 1.5vw, 1.25rem); }
.stage.try { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  .tour-shot, .tour-ring, .tour-cursor, .tour-note, .reveal, .sw-card, .sw-review { transition: none !important; animation: none !important; }
  .tour-ring.is-on { animation: none; }
  .tour-phone { animation: none; }
  .reveal { opacity: 1; transform: none; }
  .tour-tabs button[aria-selected="true"] i::after { animation: none; transform: scaleX(1); }
}

.sw-grid .photo { font-size: 2.2cqw !important; padding-top: 12% !important; }
