/* S7 · Content you own (#own) — THE FEED homepage, design.md Part III.
   "Save + Boost" (FINAL-SPEC §4 S7, profile slide 7). One flat grid: the copy,
   the magazine (M2) and the rocket/Boost column are placed by grid areas, so
   the phone order (head → sub → magazine → body → Boost) and the slide's
   5/4/3 desktop layout come from the same DOM. */

.own__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "head"
    "sub"
    "mag"
    "body"
    "cta";
  row-gap: var(--s-6);
  align-items: start;
}
.own__head {
  grid-area: head;
  display: grid;
  gap: var(--s-3);
  container-type: inline-size;
}
.own__sub {
  grid-area: sub;
  color: var(--ink);
  font-weight: 600;
  max-inline-size: 26ch;
  text-wrap: pretty;
}
.page-home:lang(ar) .own__sub {
  max-inline-size: 22ch;
}
.own__body {
  grid-area: body;
}
.own__cta {
  grid-area: cta;
  display: grid;
  justify-items: start;
  gap: var(--s-3);
}
.own__tag {
  margin: 0;
  color: var(--ink-muted);
}

/* the headline: "CONTENT / YOU / OWN." — sized to its column so the longest
   word never overflows ("CONTENT" measures ~6.5em in Archivo at 125% width,
   so 14.5cqi leaves ~6% of the column clear before the magazine) */
.page-home .own__h2 {
  font-size: min(var(--fs-mega), 14.5cqi);
  text-wrap: nowrap;
}
.page-home:lang(ar) .own__h2 {
  font-size: min(var(--fs-ar-mega), 25cqi);
  line-height: 1.12;
}
.own__h2 .line {
  padding-block-end: 0.02em;
}
/* block, not inline-block: no baseline strut between the stacked lines; and
   inherit the heading's font + line-height (base.css's global :lang(ar) rule
   otherwise gives every span Readex Pro at the body's 1.85) */
.own__h2 .line,
.own__h2 .line > span,
.own__boost > span {
  font-family: inherit;
  line-height: inherit;
}
.own__h2 .line > span {
  display: block;
}
.page-home:lang(ar) .own__h2 .line {
  padding-block-end: 0.12em;
}
.js-motion .own__h2 .line[data-fx="wipe"] {
  transition-duration: 600ms;
  transition-delay: calc(var(--i, 0) * 120ms);
}

/* the price phrase: marker swipe lands after the body has risen */
.own__price {
  white-space: nowrap;
  font-weight: 700;
}
.js-motion .own__price.mark[data-fx="mark"]::before {
  transition-delay: 600ms;
}
.own__price-off {
  color: var(--ink);
  font-weight: 700;
}

/* ── the magazine (M2) ─────────────────────────────────────────────────── */
.mag-scene {
  grid-area: mag;
  position: relative;
  justify-self: center;
  inline-size: min(86%, 420px);
  aspect-ratio: 554 / 736;
  --p: 0.5;
  --tilt: calc((-10deg + var(--p) * 12deg) * var(--dir));
}
/* the magazine itself never mirrors (dir="ltr" on the scene) — its tilt does,
   so read the page direction from the section instead */
.own:dir(rtl) .mag-scene {
  --tilt: calc((-10deg + var(--p) * 12deg) * -1);
}
.mag__glow {
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--screen), transparent 72%);
  opacity: 0;
  pointer-events: none;
}
:root[data-theme="dark"] .mag__glow {
  opacity: 0.09;
}
.mag__sheet {
  position: absolute;
  inset: 5% 7% 3% 5%;
  border-radius: 4px;
  background: var(--screen);
  box-shadow: var(--sh-1);
  transform: translateY(calc((0.5 - var(--p)) * 4%))
    rotate(calc(var(--tilt) * 0.4 - 3deg));
}
.mag__sheet--b {
  inset: 7% 4% 2% 8%;
  transform: translateY(calc((0.5 - var(--p)) * 4%))
    rotate(calc(var(--tilt) * 0.4 + 4deg));
}
.own:dir(rtl) .mag__sheet {
  transform: translateY(calc((0.5 - var(--p)) * 4%))
    rotate(calc(var(--tilt) * 0.4 + 3deg));
}
.own:dir(rtl) .mag__sheet--b {
  transform: translateY(calc((0.5 - var(--p)) * 4%))
    rotate(calc(var(--tilt) * 0.4 - 4deg));
}
.mag__post {
  position: absolute;
  inset: 0;
  transform: translateY(calc((0.5 - var(--p)) * 10%)) rotate(var(--tilt))
    scale(calc(0.94 + var(--p) * 0.06));
}
.mag {
  inline-size: 100%;
  block-size: 100%;
}
/* "saved": the post's own bookmark glyph fills (≈ x 80%, y 71% of the art) */
.mag__bookmark {
  position: absolute;
  inset-inline-start: 78.2%;
  inset-block-start: 70.4%;
  inline-size: 7.6%;
  fill: var(--yellow);
  fill-opacity: 1;
  stroke: var(--on-yellow);
  stroke-width: 2;
  stroke-linejoin: round;
  transform-origin: 50% 40%;
}
.mag__toast {
  position: absolute;
  inset-inline-end: 3%;
  inset-block-start: 77.5%;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--on-yellow);
  color: var(--yellow);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  transform-origin: 100% 0;
}
.mag__toast:lang(ar) {
  font-family: var(--font-ar-text);
  font-size: 0.875rem;
  letter-spacing: 0;
}
/* motion: the bookmark starts empty and pops full when the driver saves it */
.js-motion .mag-scene:not(.is-saved) .mag__bookmark {
  fill-opacity: 0;
}
.js-motion .mag-scene:not(.is-saved) .mag__toast {
  opacity: 0;
  transform: translateY(6px) scale(0.8);
}
.js-motion .mag-scene.is-saved .mag__bookmark {
  animation: own-save 320ms var(--ease-pop) both;
}
.js-motion .mag__bookmark {
  transition: fill-opacity 160ms linear;
}
.js-motion .mag__toast {
  transition:
    opacity var(--d-sm) var(--ease-out) 120ms,
    transform var(--d-sm) var(--ease-pop) 120ms;
}
@keyframes own-save {
  50% {
    transform: scale(1.3);
  }
}

/* ── the rocket + Boost ────────────────────────────────────────────────── */
.own__rocket {
  grid-area: mag;
  justify-self: end;
  align-self: start;
  z-index: 2;
  inline-size: clamp(72px, 22vw, 96px);
  margin-block-start: -6%;
  margin-inline-end: 2%;
}
.rocket__fly,
.rocket__bob {
  display: block;
}
.rocket {
  display: block;
  inline-size: 100%;
  block-size: auto;
  overflow: visible;
}
.own:dir(rtl) .rocket {
  transform: scaleX(-1);
}
.rocket__line,
.rocket__ex {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rocket__window,
.rocket__flame {
  fill: var(--yellow);
}
.rocket__window {
  stroke: var(--ink);
  stroke-width: 3.2;
}
/* idle bob, only while in view */
.js-motion .rocket__bob {
  animation: own-bob 2.4s ease-in-out infinite;
  animation-play-state: var(--play);
}
@keyframes own-bob {
  50% {
    transform: translateY(-6px);
  }
}
/* launch (JS adds .is-launch on hover/focus/tap of the Boost pill, 900ms) */
.js-motion .rocket__fly {
  transition: transform 500ms var(--ease-out);
}
.js-motion .own__rocket.is-launch .rocket__ex {
  stroke-dasharray: 10;
  animation: own-exhaust 420ms var(--ease-out) both;
}
@keyframes own-exhaust {
  from {
    stroke-dashoffset: 10;
  }
  to {
    stroke-dashoffset: 0;
  }
}
.js-motion .own__rocket.is-launch .rocket__fly {
  transform: translate(calc(40px * var(--dir)), -60px)
    rotate(calc(12deg * var(--dir)));
}
.js-motion .rocket__flame {
  transform-box: fill-box;
  transform-origin: 50% 0;
  transition: transform 300ms var(--ease-pop);
}
.js-motion .own__rocket:not(.is-launch) .rocket__flame {
  transform: scaleY(0.55);
}

.own__boost {
  min-block-size: 56px;
}
.own__arrow {
  inline-size: 20px;
  block-size: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* M2 needs room: below 600 the magazine just rises at its resting tilt */
@media (max-width: 599.98px) {
  .mag-scene {
    --p: 0.5 !important;
  }
}

/* ── ≥900: the slide's 5 / 4 / 3 columns ───────────────────────────────── */
@media (min-width: 900px) {
  .own__grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 4fr) minmax(0, 3fr);
    grid-template-rows: auto 1fr auto auto;
    grid-template-areas:
      "head mag ."
      "head mag rocket"
      "body mag sub"
      "body mag cta";
    /* wide enough that the magazine's tilted corner (it swings ~10% of its
       height sideways during M2) never reaches the headline */
    column-gap: clamp(32px, 4vw, 72px);
    row-gap: var(--s-5);
  }
  .own__head {
    align-self: start;
  }
  .own__body {
    align-self: end;
  }
  .mag-scene {
    grid-row: 1 / -1;
    align-self: center;
    inline-size: min(88%, 470px);
  }
  .own__rocket {
    grid-area: rocket;
    justify-self: start;
    align-self: end;
    inline-size: clamp(112px, 10vw, 150px);
    margin: 0;
  }
  .own__sub {
    align-self: end;
  }
  .own__cta {
    align-self: start;
  }
  /* the 3fr column is ~216px at 1024: the pill fits its column and its
     label wraps there instead of running past the section edge */
  .own .own__boost {
    max-inline-size: 100%;
    padding-inline: clamp(16px, 1.6vw, 26px);
    white-space: normal;
    text-wrap: balance;
  }
}
