/* Signature Strengths as six landscape event tickets (laptops and larger), two across and three down. Front: photograph
   full-bleed on the left, the strength's name large with its opening line and a big number, a perforated stub on the
   right with a small header, a vertical barcode and its number. Back: Ella's full text. Printed on a real paper
   texture (img/strengths/paper.jpg, free Unsplash) with punched notches at the tear line and a soft shadow.
   Phones and tablets keep the postcard deck. */
.tix { display: none; }

@media (min-width: 1025px) {
  #s05 .deck, #s05 .deck__hint { display: none !important; }
  .tix {
    --stub: 17%;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(30px, 3.6vw, 56px) clamp(36px, 4.4vw, 72px);
    max-width: 1180px; margin: clamp(40px, 6vh, 72px) auto 0; perspective: 2000px;
  }
  .tix__t { all: unset; display: block; position: relative; cursor: pointer; aspect-ratio: 2.75 / 1; }
  .tix__t:focus-visible { outline: 1px solid #ededea; outline-offset: 8px; }
  .tix__t::before {
    content: ""; position: absolute; left: 3%; right: 3%; top: 10%; bottom: -2%; z-index: -1;
    background: rgba(0, 0, 0, .7); filter: blur(14px); border-radius: 6px; pointer-events: none;
  }
  .tix__in { position: absolute; inset: 0; display: block; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.2, .7, .2, 1); }
  .tix__t.is-turned .tix__in { transform: rotateX(180deg); }
  .tix__f, .tix__b {
    position: absolute; inset: 0; display: flex; overflow: hidden; border-radius: 2px;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
    color: #111; font-family: var(--display, "Newsreader", serif);
    background: #f2efe9 url("../img/strengths/paper.jpg") center / cover;
    -webkit-mask: radial-gradient(circle 7px at calc(100% - var(--stub)) 0, transparent 6.5px, #000 7px), radial-gradient(circle 7px at calc(100% - var(--stub)) 100%, transparent 6.5px, #000 7px);
    -webkit-mask-composite: source-in;
    mask: radial-gradient(circle 7px at calc(100% - var(--stub)) 0, transparent 6.5px, #000 7px), radial-gradient(circle 7px at calc(100% - var(--stub)) 100%, transparent 6.5px, #000 7px);
    mask-composite: intersect;
  }
  .tix__b { transform: rotateX(180deg); }

  /* front */
  .tix__ph { flex: 0 0 35%; display: block; overflow: hidden; background: #ddd; }
  .tix__ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .tix__mid { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; padding: clamp(14px, 1.6vw, 24px) clamp(14px, 1.6vw, 24px) clamp(12px, 1.3vw, 20px); min-width: 0; }
  .tix__name { font-size: clamp(20px, 1.85vw, 30px); line-height: 1.02; letter-spacing: -.01em; }
  .tix__lead { margin-top: 10px; font-size: clamp(11px, .82vw, 12.5px); line-height: 1.4; color: #2b2b28; }
  .tix__big { margin-top: auto; align-self: flex-end; font-size: clamp(34px, 3.4vw, 54px); font-weight: 300; line-height: .9; letter-spacing: -.02em; }

  /* stub: small header, then a vertical barcode with its number */
  .tix__stub { position: relative; flex: 0 0 var(--stub); display: flex; flex-direction: column; gap: 8px; padding: clamp(12px, 1.2vw, 18px) 10px clamp(10px, 1vw, 14px) 12px; border-left: 1.5px dotted rgba(20, 20, 20, .45); box-sizing: border-box; overflow: hidden; }
  .tix__meta { font-size: 9.5px; line-height: 1.35; letter-spacing: .04em; color: #2b2b28; }
  .tix__code { flex: 1 1 auto; display: flex; gap: 6px; min-height: 0; }
  .tix__bar { position: relative; display: block; width: 28px; flex: 0 0 28px; overflow: hidden; }
  .tix__bar i { position: absolute; left: 0; right: 0; background: #111; }
  .tix__serial { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 9.5px; letter-spacing: .12em; color: #2b2b28; }

  /* back */
  .tix__bmid { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; padding: clamp(14px, 1.8vw, 26px) clamp(18px, 2.4vw, 36px); min-width: 0; }
  .tix__bname { font-size: clamp(15px, 1.2vw, 19px); line-height: 1.1; }
  .tix__body { margin-top: 8px; font-size: clamp(11px, .84vw, 13px); line-height: 1.5; color: #222; }
}
@media (min-width: 1025px) and (prefers-reduced-motion: reduce) {
  .tix__in { transition: none; }
}

/* Stacked like tickets dropped on a table: six overlapping, each a little lower, further right and turned. Hovering a
   ticket brings it to the front; clicking turns it over to the back (click again to turn it back) */
@media (min-width: 1025px) {
  .tix { display: block; position: relative; max-width: 1180px; aspect-ratio: 1 / .64; gap: 0; perspective: none; }
  .tix__t {
    position: absolute; width: 54%; left: var(--x); top: var(--y); z-index: var(--z);
    transform: rotate(var(--r)); transition: transform .45s cubic-bezier(.2, .7, .2, 1);
    perspective: 1800px;
  }
  .tix__t:nth-child(1) { --x: 0%;  --y: 3%;  --r: -6deg;   --z: 1; }
  .tix__t:nth-child(2) { --x: 9%;  --y: 15%; --r: -2.5deg; --z: 2; }
  .tix__t:nth-child(3) { --x: 18%; --y: 27%; --r: -5deg;   --z: 3; }
  .tix__t:nth-child(4) { --x: 27%; --y: 39%; --r: -1.5deg; --z: 4; }
  .tix__t:nth-child(5) { --x: 36%; --y: 51%; --r: -4deg;   --z: 5; }
  .tix__t:nth-child(6) { --x: 46%; --y: 63%; --r: 1deg;    --z: 6; }
  .tix__t:hover, .tix__t:focus-visible, .tix__t.is-turned { z-index: 20; transform: rotate(var(--r)) translateY(-14px) scale(1.03); }
  .tix__t:hover::before, .tix__t:focus-visible::before { background: rgba(0, 0, 0, .85); filter: blur(22px); }
}

/* Ticket shape after Ella's reference: generously rounded corners, round notches punched top and bottom where the stub
   tears off, and a fine dashed tear line between them */
@media (min-width: 1025px) {
  .tix__f, .tix__b {
    border-radius: 12px;
    -webkit-mask: radial-gradient(circle 11px at calc(100% - var(--stub)) 0, transparent 10.5px, #000 11px), radial-gradient(circle 11px at calc(100% - var(--stub)) 100%, transparent 10.5px, #000 11px);
    -webkit-mask-composite: source-in;
    mask: radial-gradient(circle 11px at calc(100% - var(--stub)) 0, transparent 10.5px, #000 11px), radial-gradient(circle 11px at calc(100% - var(--stub)) 100%, transparent 10.5px, #000 11px);
    mask-composite: intersect;
  }
  .tix__ph { border-radius: 12px 0 0 12px; }
  .tix__stub {
    border-left: 0;
    background-image: linear-gradient(rgba(20, 20, 20, .55) 50%, transparent 50%);
    background-size: 1px 8px; background-repeat: repeat-y; background-position: 0 14px;
    background-clip: content-box, border-box;
  }
  .tix__stub { background-origin: border-box; background-size: 1px 8px; background-position: left top 14px; }
  .tix__t::before { border-radius: 14px; }
}
@media (min-width: 1025px) {
  .tix__stub { background: none; }
  .tix__stub::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; border-left: 1.5px dashed rgba(20, 20, 20, .5); }
}
/* the photographs are printed on the same paper: its grain and fibres show through the ink */
@media (min-width: 1025px) {
  .tix__ph { position: relative; }
  .tix__ph::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: url("../img/strengths/paper.jpg") center / cover;
    mix-blend-mode: multiply; opacity: .9;
  }
  .tix__ph img { filter: contrast(.96) saturate(.92); }
}

/* Back: the number large and the name on the left, Ella's text on the right with its opening line set apart */
@media (min-width: 1025px) {
  .tix__bmid { display: grid; grid-template-columns: minmax(0, 30%) minmax(0, 1fr); gap: clamp(16px, 2vw, 30px); align-items: stretch; padding: clamp(16px, 1.8vw, 26px) clamp(18px, 2.2vw, 32px); }
  .tix__bleft { display: flex; flex-direction: column; justify-content: space-between; padding-right: clamp(12px, 1.4vw, 20px); border-right: 1px solid rgba(20, 20, 20, .18); }
  .tix__bbig { font-size: clamp(34px, 3.4vw, 54px); font-weight: 300; line-height: .9; letter-spacing: -.02em; }
  .tix__bname { font-size: clamp(15px, 1.25vw, 20px); line-height: 1.1; }
  .tix__btext { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
  .tix__blead { font-size: clamp(13px, 1.05vw, 16px); line-height: 1.3; color: #111; }
  .tix__brest { font-size: clamp(10.5px, .8vw, 12.5px); line-height: 1.5; color: #333; }
}

/* One laptop screen: the title and the fan together fill exactly the window.
   The six tickets fan out from the centre like a hand of cards, pivoting on a point below the stack. Hovering a ticket
   lifts it to the front; clicking turns it over. Type inside a ticket scales with the ticket. */
@media (min-width: 1025px) {
  #s05 { height: 100vh; min-height: 640px; box-sizing: border-box; padding-top: clamp(84px, 11vh, 120px); padding-bottom: clamp(16px, 3vh, 32px); display: flex; flex-direction: column; }
  #s05 > .wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #s05 .sec__title { flex: 0 0 auto; }
  .tix { flex: 1 1 auto; min-height: 0; width: 100%; max-width: none; aspect-ratio: auto; margin: clamp(12px, 2vh, 24px) 0 0; container-type: size; }
  .tix__t {
    width: min(44cqw, 52cqh * 2.75); left: 50%; top: auto; bottom: 4cqh;
    transform-origin: 50% 320%; transform: translateX(-50%) rotate(var(--r));
    container-type: inline-size;
  }
  .tix__t:nth-child(1) { --r: -15deg;  --z: 1; }
  .tix__t:nth-child(2) { --r: -9deg;   --z: 2; }
  .tix__t:nth-child(3) { --r: -3deg;   --z: 3; }
  .tix__t:nth-child(4) { --r: 3deg;    --z: 4; }
  .tix__t:nth-child(5) { --r: 9deg;    --z: 5; }
  .tix__t:nth-child(6) { --r: 15deg;   --z: 6; }
  .tix__t:hover, .tix__t:focus-visible, .tix__t.is-turned { z-index: 20; transform: translateX(-50%) rotate(var(--r)) translateY(-5cqh) scale(1.04); }

  /* type follows the ticket's own width */
  .tix__mid { padding: 4cqi 4cqi 3.4cqi; }
  .tix__name { font-size: 5.4cqi; }
  .tix__lead { margin-top: 1.8cqi; font-size: 2.3cqi; }
  .tix__big { font-size: 10cqi; }
  .tix__bmid { padding: 3.6cqi 4cqi; gap: 3.4cqi; }
  .tix__bbig { font-size: 9cqi; }
  .tix__bname { font-size: 3.3cqi; }
  .tix__blead { font-size: 2.85cqi; }
  .tix__brest { font-size: 2.1cqi; }

  /* clean stub: one vertical barcode, centred */
  .tix__stub { justify-content: center; align-items: center; padding: 3cqi 0; }
  .tix__code { flex: 0 0 auto; height: 70%; justify-content: center; }
  .tix__bar { width: 4.6cqi; flex: 0 0 4.6cqi; height: 100%; }
}
/* fan tuning: larger tickets, wider spread, the whole fan centred in the space under the title */
@media (min-width: 1025px) {
  .tix__t { width: min(50cqw, 44cqh * 2.75); bottom: 36cqh; transform-origin: 50% 260%; }
  .tix__t:nth-child(1) { --r: -22deg; }
  .tix__t:nth-child(2) { --r: -13deg; }
  .tix__t:nth-child(3) { --r: -4.4deg; }
  .tix__t:nth-child(4) { --r: 4.4deg; }
  .tix__t:nth-child(5) { --r: 13deg; }
  .tix__t:nth-child(6) { --r: 22deg; }
}

/* Fan from the centre, vertically: tickets 03 and 04 lie almost flat in the middle; those above tilt up and those
   below tilt down, a little more the further they are from the centre */
@media (min-width: 1025px) {
  .tix__t {
    width: min(44cqw, 40cqh * 2.75); left: 50%; top: 50%; bottom: auto;
    transform-origin: 50% 50%;
    transform: translate(-50%, -50%) translateY(var(--y)) rotate(var(--r));
  }
  .tix__t:nth-child(1) { --y: -24cqh;  --r: -8deg; }
  .tix__t:nth-child(2) { --y: -14.4cqh; --r: -5deg; }
  .tix__t:nth-child(3) { --y: -4.8cqh;  --r: -1.5deg; }
  .tix__t:nth-child(4) { --y: 4.8cqh;   --r: 1.5deg; }
  .tix__t:nth-child(5) { --y: 14.4cqh;  --r: 5deg; }
  .tix__t:nth-child(6) { --y: 24cqh;    --r: 8deg; }
  .tix__t:hover, .tix__t:focus-visible, .tix__t.is-turned { transform: translate(-50%, -50%) translateY(var(--y)) rotate(var(--r)) translateX(2.5cqw) scale(1.04); }
}
@media (min-width: 1025px) {
  .tix__t { width: min(40cqw, 36cqh * 2.75); }
  .tix__t:nth-child(1) { --y: -21cqh;  --r: -14deg; }
  .tix__t:nth-child(2) { --y: -12.6cqh; --r: -8.5deg; }
  .tix__t:nth-child(3) { --y: -4.2cqh;  --r: -2.5deg; }
  .tix__t:nth-child(4) { --y: 4.2cqh;   --r: 2.5deg; }
  .tix__t:nth-child(5) { --y: 12.6cqh;  --r: 8.5deg; }
  .tix__t:nth-child(6) { --y: 21cqh;    --r: 14deg; }
}
/* a clicked ticket comes to the middle of the fan, straightens and grows a little, then shows its back */
@media (min-width: 1025px) {
  .tix__t.is-turned { z-index: 30; transform: translate(-50%, -50%) translateX(-5cqw) scale(1.1); transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
  .tix__t.is-turned::before { background: rgba(0, 0, 0, .9); filter: blur(26px); }
}

/* Laptops: two panels on one screen, the title on the left and the fan of tickets on the right */
@media (min-width: 1025px) {
  #s05 > .wrap { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); grid-template-rows: minmax(0, 1fr); column-gap: clamp(24px, 4vw, 64px); align-items: center; }
  #s05 .sec__title { grid-column: 1; grid-row: 1; font-size: clamp(44px, 4.8vw, 76px); line-height: 1.02; margin: 0; }
  .tix { grid-column: 2; grid-row: 1; height: 100%; margin: 0; }
  .tix__t { width: min(84cqw, 30cqh * 2.75); }
}

/* Laptops: the list of the six strengths sits under the title in the left panel; choosing one turns its ticket over */
@media (min-width: 1025px) {
  #s05 > .wrap { grid-template-rows: minmax(0, 1fr) auto auto minmax(0, 1fr); }
  #s05 .sec__title { grid-row: 2; align-self: end; }
  #s05 .sindex { grid-column: 1; grid-row: 3; align-self: start; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, auto); grid-auto-flow: column; gap: 18px 28px; margin: clamp(28px, 4vh, 44px) 0 0; }
  #s05 .sindex__item { font-size: 13px; }
  .tix { grid-row: 1 / -1; }
}

/* Phones and tablets: the same tickets, standing upright in a row you swipe through. Photo on top, the name, its
   opening line and the number below, the stub with its barcode at the foot behind a dashed tear line. Tap to turn a
   ticket over to Ella's full text. */
@media (max-width: 1024px) {
  #s05 .deck, #s05 .deck__hint { display: none !important; }
  .tix {
    display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    padding: 26px var(--gut, 20px) 44px; margin: 8px calc(-1 * var(--gut, 20px)) 0; scrollbar-width: none; perspective: 1600px;
  }
  .tix::-webkit-scrollbar { display: none; }
  .tix__t { all: unset; flex: 0 0 min(74vw, 320px); aspect-ratio: 1 / 1.95; position: relative; display: block; scroll-snap-align: center; container-type: inline-size; cursor: pointer; --stub: 16%; }
  .tix__t::before { content: ""; position: absolute; left: 6%; right: 6%; top: 4%; bottom: -2%; z-index: -1; background: rgba(0, 0, 0, .7); filter: blur(14px); border-radius: 14px; pointer-events: none; }
  .tix__in { position: absolute; inset: 0; display: block; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
  .tix__t.is-turned .tix__in { transform: rotateY(180deg); }
  .tix__f, .tix__b {
    position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 12px;
    backface-visibility: hidden; -webkit-backface-visibility: hidden; color: #111; font-family: var(--display, "Newsreader", serif);
    background: #f2efe9 url("../img/strengths/paper.jpg") center / cover;
    -webkit-mask: radial-gradient(circle 11px at 0 calc(100% - var(--stub)), transparent 10.5px, #000 11px), radial-gradient(circle 11px at 100% calc(100% - var(--stub)), transparent 10.5px, #000 11px);
    -webkit-mask-composite: source-in;
    mask: radial-gradient(circle 11px at 0 calc(100% - var(--stub)), transparent 10.5px, #000 11px), radial-gradient(circle 11px at 100% calc(100% - var(--stub)), transparent 10.5px, #000 11px);
    mask-composite: intersect;
  }
  .tix__b { transform: rotateY(180deg); }
  .tix__ph { position: relative; flex: 0 0 44%; display: block; overflow: hidden; border-radius: 12px 12px 0 0; background: #ddd; }
  .tix__ph img { display: block; width: 100%; height: 100%; object-fit: cover; filter: contrast(.96) saturate(.92); }
  .tix__ph::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: url("../img/strengths/paper.jpg") center / cover; mix-blend-mode: multiply; opacity: .9; }
  .tix__mid { flex: 1 1 auto; display: flex; flex-direction: column; padding: 6cqi 6cqi 3cqi; min-height: 0; }
  .tix__name { font-size: 8.4cqi; line-height: 1.05; letter-spacing: -.01em; }
  .tix__lead { margin-top: 3cqi; font-size: 4.3cqi; line-height: 1.4; color: #2b2b28; }
  .tix__big { margin-top: auto; align-self: flex-end; font-size: 15cqi; font-weight: 300; line-height: .9; letter-spacing: -.02em; }
  .tix__stub { position: relative; flex: 0 0 var(--stub); display: flex; align-items: center; justify-content: center; padding: 0; border: 0; }
  .tix__stub::before { content: ""; position: absolute; top: 0; left: 18px; right: 18px; border-top: 1.5px dashed rgba(20, 20, 20, .5); }
  .tix__code { display: block; transform: rotate(90deg); }
  .tix__bar { position: relative; display: block; width: 9cqi; height: 34cqi; overflow: hidden; }
  .tix__bar i { position: absolute; left: 0; right: 0; background: #111; }
  .tix__bmid { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4cqi; padding: 7cqi 6cqi 4cqi; min-height: 0; }
  .tix__bleft { display: flex; align-items: flex-end; justify-content: space-between; gap: 4cqi; padding-bottom: 4cqi; border-bottom: 1px solid rgba(20, 20, 20, .18); }
  .tix__bbig { font-size: 13cqi; font-weight: 300; line-height: .9; }
  .tix__bname { font-size: 5.6cqi; line-height: 1.1; text-align: right; }
  .tix__btext { display: flex; flex-direction: column; gap: 3cqi; }
  .tix__blead { font-size: 4.9cqi; line-height: 1.3; color: #111; }
  .tix__brest { font-size: 3.9cqi; line-height: 1.5; color: #333; }
}
@media (max-width: 1024px) and (prefers-reduced-motion: reduce) {
  .tix__in { transition: none; }
}

/* the close button: a white round button just above the open ticket's top right corner, shown only while it is turned */
.tix .tix__t .tix__x {
  position: absolute; top: -52px; right: 0; z-index: 5; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; box-sizing: border-box;
  background: #F4F4F2; border: 0; color: #111; box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
  font: 300 26px/1 var(--display, serif); cursor: pointer;
  opacity: 0; pointer-events: none; transform: scale(.8); transition: opacity .3s ease .35s, transform .3s ease .35s, background .2s ease;
}
.tix .tix__t.is-turned .tix__x { opacity: 1; pointer-events: auto; transform: scale(1); }
.tix .tix__t .tix__x:hover { background: #fff; }
/* phones and tablets: the tickets sit in a sideways scroller that clips anything above it, so the close button sits inside the open ticket's top right corner */
@media (max-width: 1024px) {
  .tix .tix__t .tix__x { top: 12px; right: 12px; width: 36px; height: 36px; font-size: 24px; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
  .tix__bleft { padding-right: 40px; }
}

/* Smoother fan (7 Nov): hovering slides the ticket's face out instead of moving the ticket itself, so the area
   under the cursor stays still and the ticket no longer jumps between neighbours as the cursor crosses them */
@media (min-width: 1025px) {
  .tix__in { transition: transform .9s cubic-bezier(.2, .7, .2, 1), translate .55s cubic-bezier(.2, .7, .2, 1), scale .55s cubic-bezier(.2, .7, .2, 1); }
  .tix__t:not(.is-turned):hover,
  .tix__t:not(.is-turned):focus-visible { transform: translate(-50%, -50%) translateY(var(--y)) rotate(var(--r)); }
  .tix__t:not(.is-turned):hover .tix__in,
  .tix__t:not(.is-turned):focus-visible .tix__in { translate: 2.5cqw 0; scale: 1.04; }
  .tix__t::before { transition: background .45s ease, filter .45s ease; }
}

/* Desktops (8 Nov): one close button that never moves, at the top right corner of the deck and outside the tickets,
   instead of a button riding on whichever ticket is open (js/tickets.js) */
.tix__close { display: none; }
@media (min-width: 1025px) {
  .tix .tix__t .tix__x { display: none; }
  .tix .tix__close {
    display: flex; position: absolute; top: 0; right: 0; z-index: 400;
    width: clamp(40px, 2.2vw, 56px); height: clamp(40px, 2.2vw, 56px); border-radius: 50%;
    align-items: center; justify-content: center; box-sizing: border-box; padding: 0 0 2px;
    background: #F4F4F2; border: 0; color: #111; box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
    font: 300 clamp(26px, 1.4vw, 36px)/1 var(--display, serif); cursor: pointer;
    opacity: 0; pointer-events: none; transform: scale(.8); transition: opacity .3s ease, transform .3s ease, background .2s ease;
  }
  .tix.has-turned .tix__close { opacity: 1; pointer-events: auto; transform: scale(1); }
  .tix .tix__close:hover { background: #fff; }
}

/* Big desktops (8 Nov): the list of the six strengths under the title, larger so it reads on a big screen */
@media (min-width: 1600px) {
  #s05 .sindex { gap: clamp(22px, 1.4vw, 40px) clamp(32px, 2vw, 64px); }
  #s05 .sindex__item { font-size: clamp(16px, .95vw, 24px); }
}
