/* Direction A, The Drawing Set: the opening.
   Villa in its sheet -> surroundings dissolve, villa steps back, "This..." behind the facade
   -> a red pen draws the plan -> Ahmad's marks -> Ahmad beside the plan on its sheet.
   hero.js drives every --ds-* variable from scroll. Without it (reduced motion, short
   screens) the section is a framed photo followed by the closing spread. */
.ds-open {
  --ds-gap: clamp(14px, 2.2vh, 26px);
  --ds-tb: clamp(86px, 11.5vh, 116px);
  --ds-height: max(540px, calc(100svh - var(--atalla-header-height, 72px)));
  --ds-travel: clamp(1450px, 212svh, 1950px);
  --ds-mono: ui-monospace, "SF Mono", Menlo, monospace;
  position: relative;
  background: var(--paper);
  color: var(--ink);
}
.ds-pin { position: relative; isolation: isolate; }
.ds-stage { position: relative; }
.ds-grid, .ds-ground, .ds-shadow, .ds-this, .ds-arrow--this, .ds-cutlayer,
.ds-planbox, .ds-stagelabel, .ds-skip, .ds-progress { display: none; }

/* Red pen arrows: under "This" towards the villa, and back from "Starts with this" to the drawing.
   --d is how much of the line is drawn (0 to 1); the head appears over the last fifth. */
.ds-arrow { display: block; height: auto; overflow: visible; fill: none; stroke: var(--red); stroke-width: 4.8; stroke-linecap: round; stroke-linejoin: round; }
.ds-arrow--starts { stroke-width: 12; }
.ds-arrow path { stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--d, 1)); }
.ds-arrow .ds-arrow-head { stroke-dashoffset: calc(1 - clamp(0, (var(--d, 1) - .8) * 5, 1)); }
.ds-arrow.ds-arrow--this { display: none; } /* only the animated opening shows it */
.ds-arrow--starts {
  --d: var(--ds-arrow-starts, 1);
  width: clamp(150px, 15vw, 270px);
  margin: clamp(14px, 2.4vh, 26px) 0 0 calc(-1 * clamp(24px, 3.6vw, 64px));
  transform: scaleX(-1);
}

/* Frame 1: the villa inside the sheet, with a title block. */
.ds-photolayer, .ds-cutlayer {
  position: relative;
  margin: var(--ds-gap) var(--gutter) 0;
  height: calc(var(--ds-height) - var(--ds-tb) - var(--ds-gap) * 3);
  overflow: hidden;
  background: #172129;
}
.ds-photolayer img, .ds-cutlayer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 52% 52%;
}
.ds-cutlayer { background: none; overflow: visible; }
/* Emaar's rear facade, traced in hero-assets/mareva-2-facade-mask.svg (white keeps the building). */
.ds-cutlayer img {
  -webkit-mask: url("hero-assets/mareva-2-facade-mask.svg") 52% 52% / cover no-repeat;
  mask: url("hero-assets/mareva-2-facade-mask.svg") 52% 52% / cover no-repeat;
}

.ds-titleblock {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr) auto;
  margin: var(--ds-gap) var(--gutter) 0;
  min-height: var(--ds-tb);
  border: 1px solid var(--ink);
  background: var(--paper);
}
.ds-titleblock > * { display: flex; flex-direction: column; justify-content: center; padding: 12px clamp(14px, 1.6vw, 26px); min-width: 0; }
.ds-titleblock > * + * { border-left: 1px solid var(--ink); }
.ds-name { font-size: clamp(30px, 3.1vw, 50px); font-weight: 680; letter-spacing: -.045em; line-height: 1; }
.ds-name span, .ds-starts-line span, .ds-advisor h1 b, .ds-this span { color: var(--red); }
.ds-role { margin-top: 6px; font-size: clamp(14px, 1.15vw, 18px); color: var(--muted); }
.ds-credit { font: 500 12px/1.5 var(--ds-mono); color: var(--muted); letter-spacing: .02em; }
.ds-titleblock .ds-cta { justify-content: center; }
.ds-titleblock .action { white-space: nowrap; }

/* Closing spread: Ahmad left, the plan on its sheet right. */
.ds-close {
  display: grid;
  grid-template-columns: minmax(0, 42fr) minmax(0, 55fr);
  gap: clamp(24px, 4vw, 64px);
  padding: clamp(48px, 8vh, 96px) var(--gutter) clamp(48px, 8vh, 96px);
}
.ds-advisor { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; }
.ds-portrait { position: relative; min-height: clamp(320px, 52vh, 620px); margin: 0; overflow: hidden; background: #1b211b; }
.ds-portrait img { position: absolute; inset: 0; height: 100%; object-fit: cover; object-position: 50% 16%; }
.ds-advisor-copy { padding-top: clamp(14px, 2.4vh, 26px); }
.ds-advisor h1 { font-size: clamp(28px, 2.75vw, 50px); font-weight: 650; letter-spacing: -.045em; line-height: 1; text-wrap: balance; }
.ds-advisor h1 b { font-weight: inherit; }
.ds-advisor-copy > p { margin-top: clamp(8px, 1.3vh, 14px); color: var(--muted); font-size: clamp(14px, 1.08vw, 17px); line-height: 1.45; max-width: 46ch; }
.ds-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: clamp(12px, 2vh, 22px); }
.action-line { color: var(--ink); border-color: var(--ink); }
.action-line:hover { background: var(--ink); color: var(--paper); }

.ds-sheet {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .92fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--ink);
  min-width: 0;
}
.ds-sheet-label {
  grid-column: 1 / -1;
  padding: 12px clamp(16px, 1.8vw, 28px);
  border-bottom: 1px solid var(--ink);
  font: 500 12px/1.3 var(--ds-mono);
  color: var(--muted);
  letter-spacing: .02em;
}
.ds-sheet-plan { display: grid; place-items: center; padding: clamp(14px, 2.6vh, 30px) clamp(14px, 2vw, 32px); min-height: 0; }
.ds-sheet-plan img { width: auto; max-width: 100%; height: 100%; max-height: 58vh; aspect-ratio: 533 / 690; }
.ds-starts { align-self: center; padding: 0 clamp(16px, 2.4vw, 40px) 0 0; }
.ds-starts-line { font-size: clamp(46px, 5.6vw, 100px); font-weight: 720; letter-spacing: -.06em; line-height: .88; text-wrap: balance; }
.ds-help { margin-top: clamp(10px, 1.6vh, 18px); font-size: clamp(16px, 1.45vw, 24px); color: var(--muted); }
.ds-facts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--ink); }
.ds-facts > div { padding: 12px clamp(14px, 1.6vw, 26px); min-width: 0; }
.ds-facts > div + div { border-left: 1px solid var(--ink); }
.ds-facts dt { font-size: clamp(17px, 1.6vw, 26px); font-weight: 650; letter-spacing: -.035em; line-height: 1.05; }
.ds-facts dd { margin: 3px 0 0; font: 500 11px/1.35 var(--ds-mono); color: var(--muted); }

/* ---------- Animated mode ---------- */
.ds-open.is-animated { height: calc(var(--ds-height) + var(--ds-travel)); }
.is-animated .ds-pin {
  position: sticky;
  top: var(--ds-pin-top, var(--atalla-header-height, 72px));
  height: var(--ds-height);
  overflow: clip;
}
/* When a phone's address bar shrinks on the first scroll, the stage glides to its new centre
   instead of jumping 40px in one frame (Phil, 25 Nov 2026: "a real jerk"). */
.is-animated.ds-ready .ds-pin { transition: top .5s cubic-bezier(.23,1,.32,1); }
@media (prefers-reduced-motion: reduce) { .is-animated.ds-ready .ds-pin { transition: none; } }
.is-animated .ds-stage { position: absolute; inset: 0; }
.is-animated .ds-photolayer, .is-animated .ds-cutlayer {
  position: absolute;
  margin: 0;
  height: auto;
  aspect-ratio: auto;
  left: var(--gutter);
  right: var(--gutter);
  top: var(--ds-gap);
  bottom: calc(var(--ds-tb) + var(--ds-gap) * 2);
  transform-origin: var(--ds-ox, 100%) var(--ds-oy, 80%);
  transform: scale(var(--ds-step, 1));
  pointer-events: none;
}
.is-animated .ds-photolayer { z-index: 1; opacity: var(--ds-photo, 1); }
/* The cut-out stays inside the photo frame until the surroundings have gone, then opens up. */
.is-animated .ds-cutlayer {
  display: block;
  z-index: 4;
  opacity: var(--ds-villa, 1);
  translate: 0 var(--ds-villa-lift, 0px);
  clip-path: inset(calc(var(--ds-open, 0) * -60%));
}

.is-animated .ds-grid {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: linear-gradient(#cfcbbd 1px, transparent 1px), linear-gradient(90deg, #cfcbbd 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 62% 66% at 50% 48%, #000 30%, transparent 92%);
  mask-image: radial-gradient(ellipse 62% 66% at 50% 48%, #000 30%, transparent 92%);
  opacity: var(--ds-grid, 0);
  pointer-events: none;
}
.is-animated .ds-ground {
  display: block;
  position: absolute;
  z-index: 2;
  left: var(--gutter);
  right: var(--gutter);
  top: var(--ds-ground-y, 70%);
  border-top: 1.5px solid var(--ink);
  transform-origin: left;
  transform: scaleX(var(--ds-ground, 0));
  opacity: var(--ds-villa, 1);
}
.is-animated .ds-shadow {
  display: block;
  position: absolute;
  z-index: 2;
  left: var(--ds-shadow-x, 40%);
  width: var(--ds-shadow-w, 40%);
  top: calc(var(--ds-ground-y, 70%) - 18px);
  height: 30px;
  background: radial-gradient(closest-side, #2a24164d, transparent);
  opacity: calc(var(--ds-ground, 0) * var(--ds-villa, 1));
}
.is-animated .ds-this {
  display: block;
  position: absolute;
  z-index: 3;
  left: var(--gutter);
  top: var(--ds-this-top, 40%);
  margin: 0;
  font-size: var(--ds-this-size, 160px);
  font-weight: 720;
  letter-spacing: -.07em;
  line-height: .8;
  white-space: nowrap;
  opacity: var(--ds-this, 0);
  translate: 0 var(--ds-this-y, 0px);
  pointer-events: none;
}
.ds-this span { letter-spacing: -.02em; }
.is-animated .ds-arrow--this {
  --d: var(--ds-arrow-this, 0);
  display: block;
  position: absolute;
  z-index: 5;
  left: var(--ds-arrow-x, 10%);
  top: var(--ds-arrow-y, 75%);
  width: var(--ds-arrow-w, 30%);
  opacity: var(--ds-arrow-this-alpha, 1);
  transform: rotate(var(--ds-arrow-turn, 0deg));
  transform-origin: 0 0;
  pointer-events: none;
}

.is-animated .ds-titleblock {
  position: absolute;
  z-index: 6;
  left: var(--gutter);
  right: var(--gutter);
  bottom: var(--ds-gap);
  margin: 0;
  opacity: var(--ds-tb-alpha, 1);
  translate: 0 var(--ds-tb-y, 0px);
}

.is-animated .ds-planbox {
  display: block;
  position: absolute;
  z-index: 5;
  left: 0;
  top: 0;
  width: var(--ds-plan-w, 400px);
  aspect-ratio: 533 / 690;
  transform-origin: 0 0;
  transform: translate(var(--ds-plan-x, 0px), var(--ds-plan-y, 0px)) scale(var(--ds-plan-k, 1));
  pointer-events: none;
}
.ds-planbox img {
  width: 100%;
  height: 100%;
  clip-path: inset(0 0 calc(100% - var(--ds-draw, 0) * 100%) 0);
}
.ds-pen {
  position: absolute;
  left: -9%;
  width: 118%;
  top: calc(var(--ds-draw, 0) * 100%);
  border-top: 2px solid var(--red);
  opacity: var(--ds-pen, 0);
}
.ds-pen::after {
  content: "";
  position: absolute;
  right: -5px;
  top: -6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
}
.is-animated .ds-stagelabel, .is-animated .ds-skip {
  display: block;
  position: absolute;
  z-index: 6;
  bottom: calc(var(--ds-gap) + 4px);
  font: 500 12px/1.3 var(--ds-mono);
  color: var(--muted);
  opacity: var(--ds-chrome, 0);
}
.is-animated .ds-stagelabel { left: var(--gutter); }
.is-animated .ds-skip { right: var(--gutter); color: var(--ink); font: 650 13px/1.3 Inter, sans-serif; padding-block: 12px; margin-bottom: -12px; }
.ds-skip:hover { text-decoration: underline; text-underline-offset: 5px; }
/* Phones: no render label ("Mareva 2 · ...") and no "Meet Ahmad" link over the opening (Phil, 25 Nov 2026). */
@media (max-width: 740px) {
  .is-animated .ds-stagelabel, .is-animated .ds-skip { display: none; }
}
.is-animated .ds-progress {
  display: block;
  position: absolute;
  z-index: 7;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--red);
  transform-origin: left;
  transform: scaleX(var(--ds-progress, 0));
}

.is-animated .ds-close {
  position: absolute;
  inset: 0;
  z-index: 8;
  padding: clamp(20px, 4.5vh, 48px) var(--gutter);
  pointer-events: none;
}
.is-animated .ds-close > * { pointer-events: auto; }
.is-animated .ds-portrait { min-height: 0; clip-path: inset(0 calc(100% - var(--ds-portrait, 0) * 100%) 0 0); }
.is-animated .ds-advisor-copy { opacity: var(--ds-words, 0); translate: 0 var(--ds-words-y, 0px); }
.is-animated .ds-sheet { border-color: rgb(11 11 10 / var(--ds-sheet, 0)); }
.is-animated .ds-sheet-label, .is-animated .ds-facts { opacity: var(--ds-sheet, 0); }
.is-animated .ds-facts { border-top-color: var(--ink); }
.is-animated .ds-sheet-plan img { visibility: hidden; }
.is-animated .ds-starts-line { opacity: var(--ds-starts, 0); translate: 0 var(--ds-starts-y, 0px); }
.is-animated .ds-help, .is-animated .ds-arrow--starts { opacity: var(--ds-help, 0); }

/* ---------- Phone ---------- */
@media (max-width: 740px) {
  .ds-open { --ds-tb: 168px; --ds-travel: clamp(1280px, 196svh, 1620px); }
  .ds-arrow { stroke-width: 13; }
  .ds-arrow--starts { stroke-width: 20; }
  .ds-arrow--starts { width: 92px; margin: 10px 0 0 58%; transform: rotate(-62deg); transform-origin: 0 50%; }
  .ds-photolayer { height: auto; aspect-ratio: 4 / 5; }
  .ds-titleblock { grid-template-columns: 1fr; }
  .ds-titleblock > * + * { border-left: 0; border-top: 1px solid var(--ink); }
  .ds-titleblock .ds-credit-cell { display: none; }
  .ds-titleblock .ds-cta { padding: 0; border-top: 0; }
  .ds-titleblock .action { width: 100%; }
  .ds-close { grid-template-columns: 1fr; padding-top: 32px; }
  .ds-portrait { min-height: 0; aspect-ratio: 4 / 4.6; }
  .ds-sheet { grid-template-columns: 1fr; }
  .ds-sheet-plan img { height: auto; width: min(70%, 260px); max-height: none; }
  .ds-starts { padding: 0 16px 18px; }
  .ds-facts dd { font-size: 10px; }

  .is-animated .ds-photolayer, .is-animated .ds-cutlayer { aspect-ratio: auto; }
  .is-animated .ds-close { padding: 12px var(--gutter) 16px; grid-template-rows: minmax(0, 1fr) auto; }
  .is-animated .ds-advisor { position: relative; z-index: 2; grid-row: 1; grid-column: 1; background: var(--paper); clip-path: inset(0 calc(100% - var(--ds-portrait, 0) * 100%) 0 0); }
  .is-animated .ds-portrait { aspect-ratio: auto; clip-path: none; }
  .is-animated .ds-sheet { grid-row: 1; grid-column: 1; border: 0; align-self: start; margin-top: var(--ds-starts-mt, 0px); display: block; padding-bottom: 8px; }
  .is-animated .ds-starts { display: flex; flex-direction: column-reverse; }
  .is-animated .ds-starts .ds-arrow--starts { margin: 0 0 6px 60%; }
  .is-animated .ds-sheet-label, .is-animated .ds-sheet-plan, .is-animated .ds-facts { display: none; }
  .is-animated .ds-starts { padding: 0; }
  .is-animated .ds-starts-line { font-size: clamp(40px, 12vw, 58px); }
  .is-animated .ds-advisor-copy { padding-top: 12px; }
  .is-animated .ds-advisor h1 { font-size: clamp(24px, 7vw, 32px); }
  .is-animated .ds-actions .action-line { display: none; }
  .is-animated .ds-stagelabel { max-width: 55%; }
}

/* B6 Swoosh arrows (Phil's pick, 23 Nov): a filled stroke, thick at the start and thinning into a
   notched, sharp head. It draws in left to right as --d goes 0 to 1: the svg is clipped from the
   right in its own frame, so the head always arrives last (and the phone's turned arrow still
   draws along its length). No masks, so Safari draws it too. Two pen weights: desktop and phone. */
.ds-arrow { clip-path: inset(-40% calc(110% - var(--d, 1) * 120%) -40% -10%); }
.ds-arrow .b6-m { display: none; }
@media (max-width: 740px) {
  .ds-arrow .b6-d { display: none; }
  .ds-arrow .b6-m { display: inline; }
}
/* The head waits for the line, so no corner of it shows ahead of the pen. */
.ds-arrow g > path:last-child { opacity: clamp(0, (var(--d, 1) - .74) * 10, 1) !important; }
