/* 25 What to expect. Sits straight under the about heading on the same ivory ground.
   A round photo in a hairline ring and four numbered points joined to the ring by hairlines.
   The ring text and the monogram clasp were removed at the owner's request.
   The numbers read as the order of a visit (talk, advice, booking, rewards). */

.why {
  background: var(--ivory);
  --why-hair: #CDB894;            /* camel line, a touch deeper so 1px reads on ivory */
}

/* Stage: items left and right of the ring (desktop) */
.why-stage {
  --R: 270px;                     /* radius of the hairline ring */
  --gap: 44px;                    /* space between the text columns and the ring */
  --num-h: 28px;                  /* height of the numeral row, the line runs through its middle */
  --why-photo: 90%;               /* photo diameter as a share of the ring */
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) calc(var(--R) * 2) minmax(0, 1fr);
  /* numeral rows sit 0.6R above and below the centre, where the ring is 0.2R in from its edge */
  grid-template-rows: calc(var(--R) * 0.4 - var(--num-h) / 2) calc(var(--R) * 1.2) auto;
  column-gap: var(--gap);
}

.why-figure {
  grid-column: 2; grid-row: 1 / 4; align-self: start;
  position: relative; margin: 0;
  width: calc(var(--R) * 2); aspect-ratio: 1;
}
.why-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.why-ring-line { fill: none; stroke: var(--why-hair); stroke-width: 1; vector-effect: non-scaling-stroke; }
/* The photo sits in a taupe disc (the photo's own ground is the same taupe), and drifts a little as you scroll */
.why-photo-frame {
  position: absolute; left: 50%; top: 50%;
  width: var(--why-photo); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%; overflow: hidden; background: var(--cocoa);
}
.why-photo {
  width: 100%; height: 100%; object-fit: cover;
  transform: translateY(var(--why-drift, 0px)) scale(1.04);
  transition: transform .9s var(--ease);
}
.why-stage:hover .why-photo { transition-duration: 1.4s; }

/* The ring draws itself in, then a short darker arc rests on the point you are reading */
.why-ring-line { stroke-dasharray: 360; stroke-dashoffset: 0; transition: stroke-dashoffset 1.6s var(--ease); }
.js .why-stage:not(.is-in) .why-ring-line { stroke-dashoffset: 360; }
.why-ring-arc {
  /* 26 degrees of a 497 radius ring is about 225 units of its 3123 */
  fill: none; stroke: var(--cocoa); stroke-width: 3.6; stroke-dasharray: 225 2898; stroke-linecap: round;
  transform-origin: 500px 500px; transform: rotate(calc(var(--why-angle, 216.87deg) - 13deg));
  transition: transform .8s var(--ease), opacity .6s var(--ease) 1.2s;
}
.js .why-stage:not(.is-in) .why-ring-arc { opacity: 0; }

/* Items */
.why-item { position: relative; max-width: 300px; }
.why-item--1 { grid-column: 1; grid-row: 2; justify-self: end; text-align: right; }
.why-item--2 { grid-column: 3; grid-row: 2; justify-self: start; }
.why-item--3 { grid-column: 1; grid-row: 3; justify-self: end; text-align: right; }
.why-item--4 { grid-column: 3; grid-row: 3; justify-self: start; }

.why-num {
  position: relative; display: flex; align-items: center;
  height: var(--num-h); margin-bottom: 14px;
  font: 400 calc(22px * var(--display-scale))/1 var(--f-display);
  letter-spacing: 0.02em; color: var(--camel-ink);
}
.why-item--1 .why-num, .why-item--3 .why-num { justify-content: flex-end; }

/* Hairline from the numeral to the ring, with a small dot where it meets it */
.why-line {
  position: absolute; top: 50%; height: 1px;
  width: calc(var(--gap) + var(--R) * 0.2 - 14px);
  background: var(--why-hair);
  transition: transform 1.1s var(--ease) .45s;
}
.why-line::after {
  content: ""; position: absolute; top: 50%; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ivory); border: 1px solid var(--camel-ink); transform: translate(-50%, -50%);
}
.why-item--1 .why-line, .why-item--3 .why-line { left: calc(100% + 14px); transform-origin: left center; }
.why-item--1 .why-line::after, .why-item--3 .why-line::after { left: 100%; }
.why-item--2 .why-line, .why-item--4 .why-line { right: calc(100% + 14px); transform-origin: right center; }
.why-item--2 .why-line::after, .why-item--4 .why-line::after { left: 0; }
.js .why-stage:not(.is-in) .why-line { transform: scaleX(0); }
.why-line, .why-line::after, .why-num > span:first-child { transition-property: transform, background-color, border-color, color; transition-duration: 1.1s, .3s, .3s, .3s; transition-delay: .45s, 0s, 0s, 0s; transition-timing-function: var(--ease); }
.why-item:is(:hover, :focus-within) .why-line { background: var(--cocoa); }
.why-item:is(:hover, :focus-within) .why-line::after { background: var(--cocoa); border-color: var(--cocoa); }
.why-item:is(:hover, :focus-within) .why-num > span:first-child { color: var(--cocoa); }

/* Points arrive one after another once the ring has drawn */
.js .why-item { transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .why-stage:not(.is-in) .why-item { opacity: 0; transform: translateY(14px); }
.why-item--1 { transition-delay: .5s; } .why-item--2 { transition-delay: .65s; }
.why-item--3 { transition-delay: .8s; } .why-item--4 { transition-delay: .95s; }

.why-item-title {
  font-size: calc(clamp(21px, 1.75vw, 26px) * var(--display-scale));
  line-height: 1.15; letter-spacing: calc(var(--display-track) * 0.45);
  color: var(--cocoa); margin-bottom: 12px;
}
.why-item-text { font-size: 15.5px; line-height: 1.65; color: var(--mute); text-wrap: pretty; }
.why-item-text a {
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--why-hair);
  text-decoration-thickness: 1px; text-underline-offset: 4px;
  transition: text-decoration-color .25s var(--ease);
}
.why-item-text a:hover { text-decoration-color: var(--cocoa); }

/* Actions */
.why-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: clamp(56px, 6vw, 88px); }

/* Smaller desktop and landscape tablet: same layout, smaller ring */
@media (max-width: 1199px) {
  .why-stage { --R: 212px; --gap: 32px; --why-photo: 88%; }
  .why-item { max-width: 270px; }
  .why-item-text { font-size: 15px; }
}

/* Portrait tablet: ring on top, items in a 2 x 2 grid below */
@media (max-width: 1023px) {
  .why-stage {
    --R: 200px;
    grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none;
    column-gap: clamp(28px, 5vw, 48px);
  }
  .why-figure { grid-column: 1 / -1; grid-row: auto; justify-self: center; margin-bottom: clamp(48px, 7vw, 72px); }
  .why-item, .why-item--1, .why-item--2, .why-item--3, .why-item--4 {
    grid-column: auto; grid-row: auto; justify-self: stretch; text-align: left; max-width: none;
    border-top: 1px solid var(--line); padding: 26px 0 34px;
  }
  .why-item--1 .why-num, .why-item--3 .why-num { justify-content: flex-start; }
  .why-line, .why-ring-arc { display: none; }
  .why-item-text { max-width: 40ch; }
}

/* Phone: one column, numeral beside the title, clean dividers */
@media (max-width: 599px) {
  .why-stage { --R: min(160px, calc(50vw - 24px)); --why-photo: 88%; grid-template-columns: minmax(0, 1fr); }
  .why-item, .why-item--1, .why-item--2, .why-item--3, .why-item--4 {
    display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: baseline;
    padding: 22px 0 26px;
  }
  .why-item:last-of-type { border-bottom: 1px solid var(--line); }
  .why-num { grid-row: 1 / 3; height: auto; margin: 0; font-size: calc(19px * var(--display-scale)); }
  .why-item-title { margin-bottom: 8px; }
  .why-actions { flex-direction: column; align-items: stretch; max-width: 360px; margin-inline: auto; margin-top: 40px; }
}

/* With reduced motion the connectors are simply there, no drawing in */
@media (prefers-reduced-motion: reduce) {
  .js .why-stage:not(.is-in) .why-line { transform: none; }
  .js .why-stage:not(.is-in) .why-ring-line { stroke-dashoffset: 0; }
  .js .why-stage:not(.is-in) .why-item, .js .why-stage:not(.is-in) .why-ring-arc { opacity: 1; transform: none; }
  .why-photo { transform: none; }
}

/* Follows the about heading directly, so it needs little top space */
.why.section { padding-top: clamp(8px, 2vw, 32px); }
