/*
Theme Name: Chrome Stories
Theme URI: https://example.com/chrome-stories
Author: Claude
Author URI: https://anthropic.com
Description: A personalized "Chrome Stories" theme with a full-screen scroll-snap homepage. Each scroll reveals a new persona card (Vittorio, Diana, June…) with floating UI cards — bookmarks, maps, shopping, watch-later — inspired by Google Chrome personalization stories.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: chrome-stories
Tags: full-screen, scroll-snap, one-page, custom-colors, animated
*/

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  --cs-bg: #f3f6f4;
  --cs-text: #1f2421;
  --cs-white: #ffffff;
  --cs-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.28);
  --cs-shadow-sm: 0 8px 24px -8px rgba(0, 0, 0, 0.22);
  --cs-radius-lg: 34px;
  --cs-radius-md: 18px;
  --cs-radius-pill: 999px;
  --cs-font-display: "Google Sans", "Product Sans", "Poppins", system-ui, sans-serif;
  --cs-font-body: "Inter", system-ui, -apple-system, sans-serif;
}

/* ============================================
   RESET
   ============================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--cs-font-body);
  color: var(--cs-text);
  background: var(--cs-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }

/* ============================================
   3D ROTATING CAROUSEL STAGE
   ============================================ */
.cs-stories {
  height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1700px;
  perspective-origin: 50% 48%;
  overflow: hidden;
  transition: background 0.8s ease;
  background: linear-gradient(160deg, #e8f0fe, #f1f5fb);
}
.cs-stories[data-bg="green"]  { background: linear-gradient(160deg, #eafaf0, #f3f6f4); }
.cs-stories[data-bg="yellow"] { background: linear-gradient(160deg, #fef6e4, #fbf7ef); }
.cs-stories[data-bg="blue"]   { background: linear-gradient(160deg, #e8f0fe, #f1f5fb); }
.cs-stories[data-bg="rose"]   { background: linear-gradient(160deg, #fdeceb, #faf3f2); }

/* deck holds the slides in 3D space */
.cs-deck {
  position: relative;
  width: min(420px, 92vw);
  aspect-ratio: 9 / 16;
  transform-style: preserve-3d;
}

/* each persona is a slide that rotates through 3D space */
.cs-story {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  transition:
    transform 0.9s cubic-bezier(0.55, 0.05, 0.30, 1),
    opacity   0.9s ease;
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* slide positions: incoming (right, rotated), centre, outgoing (left, rotated) */
.cs-story.is-center {
  transform: translateX(0) translateZ(0) rotateY(0deg) scale(1);
  opacity: 1;
  z-index: 3;
}
.cs-story.is-right {
  transform: translateX(70%) translateZ(-520px) rotateY(-58deg) scale(0.92);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}
.cs-story.is-left {
  transform: translateX(-70%) translateZ(-520px) rotateY(58deg) scale(0.92);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

/* ============================================
   PHONE / CARD STAGE
   ============================================ */
.cs-stage {
  position: relative;
  width: min(420px, 92vw);
  aspect-ratio: 9 / 16;
  border-radius: var(--cs-radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 56px 28px;
  color: var(--cs-white);
  box-shadow: var(--cs-shadow);
}
.cs-story[data-theme="green"]  .cs-stage { background: #34a853; }
.cs-story[data-theme="yellow"] .cs-stage { background: #f4b400; }
.cs-story[data-theme="blue"]   .cs-stage { background: #1a73e8; }
.cs-story[data-theme="rose"]   .cs-stage { background: #ea6b66; }
.cs-stage { width: 100%; height: 100%; }

.cs-stage__title,
.cs-stage__name {
  font-family: var(--cs-font-display);
  font-weight: 500;
  font-size: clamp(34px, 8vw, 48px);
  text-align: center;
  line-height: 1.05;
  margin: 0;
  letter-spacing: -0.5px;
}

/* center avatar */
.cs-avatar {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 190px;
  height: 190px;
  border-radius: 50%;
  overflow: hidden;
  object-fit: cover;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

/* ============================================
   FLOATING UI CARDS
   ============================================ */
.cs-float {
  position: absolute;
  background: var(--cs-white);
  color: var(--cs-text);
  border-radius: var(--cs-radius-md);
  box-shadow: var(--cs-shadow-sm);
  padding: 12px;
  width: 220px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(28px) scale(0.96);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.cs-story.is-center .cs-float { opacity: 1; transform: translateY(0) scale(1); }
.cs-story.is-center .cs-float:nth-child(2) { transition-delay: 0.10s; }
.cs-story.is-center .cs-float:nth-child(3) { transition-delay: 0.20s; }
.cs-story.is-center .cs-float:nth-child(4) { transition-delay: 0.30s; }
.cs-story.is-center .cs-float:nth-child(5) { transition-delay: 0.40s; }

/* ambient "breathing" drift once a slide has settled in the centre */
.cs-story.is-center .cs-float  { animation: cs-drift 6s ease-in-out 0.9s infinite; }
.cs-story.is-center .cs-float--tr,
.cs-story.is-center .cs-float--br { animation-name: cs-drift-alt; animation-duration: 7s; }
.cs-story.is-center .cs-pill   { animation: cs-drift 5.5s ease-in-out 1s infinite; }

@keyframes cs-drift {
  0%, 100% { transform: translateY(0)     scale(1); }
  50%      { transform: translateY(-8px)  scale(1); }
}
@keyframes cs-drift-alt {
  0%, 100% { transform: translateY(0)     scale(1); }
  50%      { transform: translateY(7px)   scale(1); }
}

.cs-float img { border-radius: 10px; margin-bottom: 8px; }
.cs-float__title { font-weight: 600; margin: 0 0 2px; line-height: 1.25; }
.cs-float__sub   { color: #5f6368; font-size: 11px; margin: 0; }
.cs-float__btn {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  border-radius: var(--cs-radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: #eef1f0;
}

/* card positions (desktop) */
.cs-float--tl { top: 14%;  left: -16%; }
.cs-float--tr { top: 10%;  right: -18%; width: 200px; }
.cs-float--bl { bottom: 16%; left: -14%; }
.cs-float--br { bottom: 22%; right: -16%; width: 210px; }
.cs-float--mid { top: 46%; right: -20%; width: 170px; }

/* product image floats (drone / headphones / bag) */
.cs-product {
  position: absolute;
  bottom: 8%;
  right: -6%;
  width: 200px;
  filter: drop-shadow(0 20px 30px rgba(0,0,0,0.35));
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease 0.2s, transform 0.7s ease 0.2s;
}
.cs-story.is-center .cs-product { opacity: 1; transform: translateY(0); animation: cs-drift-alt 8s ease-in-out 1.1s infinite; }

/* little circular pill labels */
.cs-pill {
  position: absolute;
  background: var(--cs-white);
  color: var(--cs-text);
  border-radius: var(--cs-radius-pill);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--cs-shadow-sm);
  top: 42%;
  right: -22%;
  opacity: 0;
  transition: opacity 0.6s ease 0.35s;
}
.cs-story.is-center .cs-pill { opacity: 1; }
.cs-pill .dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: currentColor; opacity: .15;
}

/* ============================================
   DOTS NAV
   ============================================ */
.cs-dots {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  z-index: 50;
}
.cs-dots button {
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.3s, transform 0.3s;
}
.cs-dots button.is-on { background: currentColor; transform: scale(1.25); }
.cs-dots .c-green  { color: #34a853; }
.cs-dots .c-rose   { color: #ea6b66; }
.cs-dots .c-yellow { color: #f4b400; }
.cs-dots .c-blue   { color: #1a73e8; }

/* back arrow */
.cs-back {
  position: fixed;
  top: 22px; left: 22px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--cs-white);
  box-shadow: var(--cs-shadow-sm);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  font-size: 22px;
  color: var(--cs-text);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 720px) {
  .cs-float--tl  { left: -4%;  width: 170px; }
  .cs-float--tr  { right: -4%; width: 150px; }
  .cs-float--bl  { left: -4%;  width: 165px; }
  .cs-float--br  { right: -4%; width: 160px; }
  .cs-float--mid { right: 2%;  width: 140px; }
  .cs-product    { right: -2%; width: 150px; }
  .cs-pill       { right: 2%; }
  .cs-avatar     { width: 150px; height: 150px; }
}

/* ============================================
   REDUCED MOTION FALLBACK
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .cs-story { transition: opacity 0.3s ease; }
  .cs-story.is-center { transform: none; opacity: 1; }
  .cs-story.is-left,
  .cs-story.is-right { transform: none; opacity: 0; }
  .cs-story.is-center .cs-float,
  .cs-story.is-center .cs-product,
  .cs-story.is-center .cs-pill { animation: none; transition: opacity 0.3s ease; transform: none; }
}
