/* aimlink.ai app pages with a tablet: Aimlink TARGET (a tablet in landscape, at the lane) and Aimlink CLUB (an upright iPad).
   Load after app-page.css; the script is the same, assets/app-page.js. The page says which device it has with
   data-device="tablet" (landscape) | "ipad" (portrait) on .go-top. Everything the GO page does carries over:
     - the hero device rides up, rests at an angle, then glides into the tray of the pinned feature stage;
     - the features are stacked below 900 px and without motion;
     - "Read the series" has its counterpart, the same 3D card with three layers, drawn as a plan of the lane (TARGET)
       or of the range (CLUB).
   This file holds what a tablet needs that a phone does not: its frame (landscape or portrait), a landscape tray for the
   landscape one (the upright iPad keeps GO's 3:4 tray), the plan card, the shared timeline classes and the line under the
   closing store badges. The screens inside the frames are in app-screens-target.css and app-screens-club.css (HTML in the
   apps' look, as GO's are in app-page.css). */

@layer sections {
  /* ───────────────────────── The device: variables ───────────────────────── */
  .go-top[data-device="tablet"] {                               /* landscape: TARGET */
    --pw-hero: min(38vw, 720px, 86svh);                         /* the device's width in the hero */
    --dev-vis: 0.8;                                             /* a landscape device shows whole on a phone */
    --gf-r: 0.8;                                                /* the tray: landscape, 5 : 4 */
    --gf-text: 27rem;                                           /* the copy's column beside the tray */
    --gf-w: min(96svh, 46vw, 46rem, calc(100vw - 44px - var(--gf-text) - 2 * clamp(var(--space-6), 4.5vw, var(--space-8)) - 2 * var(--gutter)));
    --gf-col: 34rem; --gf-max: 36rem;
    --depth: 0.0026;                                            /* one of twelve layers of the device's body, in widths */
  }
  .go-top[data-device="ipad"] {                                 /* portrait: CLUB. The tray stays GO's 3 : 4 */
    --pw-hero: min(50svh, 31vw, 470px);
    --depth: 0.0028;
  }
  /* 640 to 899 px: the hero keeps two columns, the device beside its copy; below 640 px it sits under the copy */
  @media (min-width: 640px) and (max-width: 899.98px) {
    .go-top[data-device="tablet"] { --pw-hero: min(42vw, 400px); }
    .go-top[data-device="ipad"] { --pw-hero: min(32vw, 270px); }
  }
  @media (max-width: 639.98px) {
    .go-top[data-device="tablet"] { --pw-hero: min(90vw, 520px); }
    .go-top[data-device="ipad"] { --pw-hero: min(66vw, 300px); }
  }

  /* ───────────────────────── The tablet's frame. --tw is its width; --tl its long edge: the width in landscape, the
     height in portrait (bezel, corner radius and camera follow the long edge, as on the real thing) ───────────────────────── */
  .tab {
    --tw: 88cqw; --tl: var(--tw);
    position: relative; width: var(--tw); aspect-ratio: 1.387; padding: calc(var(--tl) * 0.006);
    border-radius: calc(var(--tl) * 0.058);
    background: linear-gradient(135deg, #8b8e93 0%, #3d3f43 14%, #26282b 50%, #424448 86%, #7e8186 100%);
    box-shadow:
      0 calc(var(--tl) * 0.03) calc(var(--tl) * 0.08) rgb(19 32 26 / 0.22),
      0 calc(var(--tl) * 0.006) calc(var(--tl) * 0.015) rgb(19 32 26 / 0.16),
      inset 0 0 0 calc(var(--tl) * 0.0012) rgb(255 255 255 / 0.12);
  }
  .tab.is-portrait { --tl: calc(var(--tw) * 1.387); aspect-ratio: 1 / 1.387; }
  /* an iPad that plays a recorded screen takes the recording's own proportions (3:4 on the glass), so it is shown 1:1 */
  .tab.is-portrait.is-recorded { --tl: calc(var(--tw) * 1.2987); aspect-ratio: 1 / 1.2987; }
  /* a landscape tablet that plays a recorded screen: the glass is 4:3 */
  .tab.is-recorded:not(.is-portrait) { aspect-ratio: 1.2987; }
  .tab::before { content: ""; position: absolute; right: 9%; top: calc(var(--tl) * -0.0035); width: 7%; height: calc(var(--tl) * 0.0045); border-radius: 2px 2px 0 0; background: #3a3c40; }
  .tab-bezel { position: relative; height: 100%; padding: calc(var(--tl) * 0.034); border-radius: calc(var(--tl) * 0.052); background: #050607; }
  .tab-cam { position: absolute; left: 50%; top: calc(var(--tl) * 0.0135); width: calc(var(--tl) * 0.0075); aspect-ratio: 1; translate: -50% 0; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #2b3a5c 0%, #0b1020 55%, #05070d 100%); }
  .tab-screen { position: relative; height: 100%; overflow: hidden; border-radius: calc(var(--tl) * 0.022); background: var(--color-night); container-type: size; transform: translateZ(0); }

  /* ───────────────────────── In the hero: the same body of layers as the phone ───────────────────────── */
  .go-phone .tab { --tw: var(--pw-hero); }
  .go-top[data-device="tablet"] .phone-depth i { border-radius: calc(var(--pw-hero) * 0.058); }
  .go-top[data-device="ipad"] .phone-depth i { border-radius: calc(var(--pw-hero) * 1.387 * 0.058); }
  .go-top[data-device] .phone-depth i { transform: translateZ(calc(var(--pw-hero) * var(--depth) * -1 * var(--k))); }
  .go-top[data-device] .phone-depth i:last-child { box-shadow: 0 calc(var(--pw-hero) * 0.04) calc(var(--pw-hero) * 0.1) rgb(0 0 0 / 0.5), 0 calc(var(--pw-hero) * 0.006) calc(var(--pw-hero) * 0.015) rgb(19 32 26 / 0.18); }
  .go-top[data-device] .go-phone-glow { inset: -30% -34%; }
  .go-top[data-device] .go-phone .app-screen { animation: phone-fade 700ms var(--ease-out) 760ms backwards; }
  @media (prefers-reduced-motion: reduce) {
    .go-top[data-device] .go-phone .app-screen { animation: none; }
  }

  /* ───────────────────────── Features: the pinned stage ─────────────────────────
     TARGET has a landscape tray (5 : 4, set by the variables above); CLUB's upright iPad sits in GO's 3 : 4 tray. */
  .go-top[data-device="tablet"].is-live .gf-stage { grid-template-columns: 44px var(--gf-media) minmax(0, var(--gf-text)); }
  .go-top[data-device="tablet"] .gf-media .tab { --tw: 88cqw; }
  .go-top[data-device="ipad"] .gf-media .tab { --tw: 76cqw; }

  /* ───────────────────────── Read the lane / Read the evening: the plan card ─────────────────────────
     GO's "Read the series" lifts three layers off a target; here they lift off a plan: the lane (TARGET) or the range
     (CLUB). Same engine, same angles (app-page.js initRest), same timings (app-page.css .app-rest). The card is a dark
     slab with a body of five layers, so lime lies on dark and never on paper. 1cqw = 1 % of the figure's width. */
  .rest-plan { max-width: 38rem; }
  .rest-plan::before { inset: -20%; }
  .rest-plan .r3d-tilt { --w: 102cqw; --step: 6.5cqw; }
  .rest-plan .r3d-disc i { inset: 0; border-radius: 5.8cqw; background: #27323d; transform: translateZ(calc(var(--k) * -0.34cqw)); }
  .rest-plan .r3d-disc i:last-of-type { background: #4a5764; box-shadow: 0 3cqw 9cqw rgb(0 0 0 / 0.6); }
  .rest-plan .r3d-disc::after {
    inset: 0; border-radius: 5.8cqw; transform: translateZ(0.05cqw);
    background: linear-gradient(112deg, rgb(255 255 255 / 0.07) 0%, transparent 38%, rgb(0 0 0 / 0.28) 100%);
  }
  .plan { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
  .pl-face { fill: #151d26; }
  .pl-lane { fill: rgb(255 255 255 / 0.045); stroke: rgb(255 255 255 / 0.17); stroke-width: 0.4; }
  .pl-line { fill: none; stroke: rgb(255 255 255 / 0.24); stroke-width: 0.4; stroke-linecap: round; stroke-linejoin: round; }
  .pl-dash { fill: none; stroke: rgb(255 255 255 / 0.2); stroke-width: 0.35; stroke-dasharray: 1.6 1.6; }
  .pl-solid { fill: rgb(255 255 255 / 0.1); stroke: rgb(255 255 255 / 0.28); stroke-width: 0.4; }
  .pl-txt { fill: #8e98a2; font: 500 4.4px/1 var(--font-numeric); letter-spacing: 0.04em; text-anchor: middle; }
  .pl-txt-s { font-size: 3.6px; letter-spacing: 0.08em; text-transform: uppercase; }
  .pl-ring { fill: none; stroke: rgb(255 255 255 / 0.32); stroke-width: 0.4; }
  .pl-ink { fill: #0b1015; }
  .pl-paper { fill: #e9edf1; }
  /* the people on the plan (CLUB): landed like shots, one per lane */
  .rest-plan .r3d-shots i {
    display: grid; place-items: center; width: 8.2%; margin: -4.1% 0 0 -4.1%; background: var(--color-stone); color: var(--color-night);
    font: 500 3.1cqw/1 var(--font-numeric); font-style: normal; letter-spacing: 0.02em; padding-top: 0.25cqw;
    box-shadow: 0 0 0 0.35cqw rgb(21 29 38 / 0.9), 0 0.8cqw 1.8cqw rgb(0 0 0 / 0.35);
  }
  .rest-plan .r3d-shots i.is-guest { background: var(--color-yellow); }
  .rest-plan .r3d-layer svg .pl-glow { fill: rgb(160 224 32 / 0.1); stroke: var(--color-lime); stroke-width: 0.5; stroke-linejoin: round; }
  .rest-plan .r3d-layer svg .pl-glow-2 { fill: rgb(160 224 32 / 0.2); }
  .rest-plan .r3d-layer svg .pl-lime { fill: none; stroke: var(--color-lime); stroke-width: 0.5; stroke-linecap: round; stroke-linejoin: round; }
  .rest-plan .r3d-layer svg .pl-limedash { fill: none; stroke: var(--color-lime); stroke-width: 0.45; stroke-dasharray: 1.4 1.4; stroke-linecap: round; }
  .rest-plan .r3d-layer svg .pl-fill { fill: var(--color-lime); }
  .rest-num.is-word { font-size: var(--type-numeric-m-size); }
  /* CLUB: where the lanes would be, two dials drawn as the stat tiles on its iPad (snow caps label, lime number on the
     tile grey). They land on the plan as the card swings up and count up (app-page.js initRest); the desk, cart and log stay below. */
  .r3d-dials { position: absolute; inset: 0; transform-style: preserve-3d; transform: translateZ(0.8cqw); }
  .pl-dial {
    position: absolute; left: var(--x); top: var(--y); width: 35%; aspect-ratio: 1; margin: -17.5% 0 0 -17.5%;
    display: grid; place-content: center; justify-items: center; gap: 1.4cqw; border-radius: 50%;
    background: var(--color-grey-2); box-shadow: inset 0 0 0 0.35cqw rgb(160 224 32 / 0.3), 0 1.6cqw 4cqw rgb(0 0 0 / 0.45);
  }
  .pl-dial .pl-k { color: var(--color-snow); font-size: 2.4cqw; font-weight: 600; line-height: 1; letter-spacing: 0.1em; text-transform: uppercase; }
  .pl-dial b { color: var(--color-lime); font: 500 13cqw/0.85 var(--font-numeric); font-variant-numeric: tabular-nums; }
  .app-rest.is-armed.is-in .pl-dial { transition: transform 340ms cubic-bezier(0.5, 0, 0.9, 0.45) calc(600ms + var(--i) * 120ms), opacity 120ms linear calc(600ms + var(--i) * 120ms); }
  .app-rest.is-armed:not(.is-in) .pl-dial { opacity: 0; transform: translateZ(44cqw) scale(1.3); }

  /* ───────────────────────── The clock: what a screen switches on at a point in its clip ─────────────────────────
     app-page.js runs it: the tray gets .is-timed and a part with data-at gets .is-on at that point (0 to 1) of the clip.
     Without it (no JS, reduced motion) every screen shows its end state. .t-in rises in, .t-fade fades in, .t-pop is a
     shot or dot that lands (SVG). Used by the TARGET and CLUB screens. */
  .is-timed .t-in[data-at] { opacity: 0; transform: translateY(1.6cqw); transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out); }
  .is-timed .t-in[data-at].is-on { opacity: 1; transform: none; }
  .is-timed .t-fade[data-at] { opacity: 0; transition: opacity 320ms var(--ease-out); }
  .is-timed .t-fade[data-at].is-on { opacity: 1; }
  .is-timed .t-pop[data-at] { opacity: 0; transform: scale(2.4); transform-box: fill-box; transform-origin: center; transition: opacity 120ms linear, transform 260ms var(--ease-out); }
  .is-timed .t-pop[data-at].is-on { opacity: 1; transform: none; }

  /* a number on the left lifts its layer (the keys of the plan cards; GO's group, avg and tend are in app-page.css) */
  .rest-target[data-focus="cart"] .r3d-layer[data-layer="cart"],
  .rest-target[data-focus="log"] .r3d-layer[data-layer="log"],
  .rest-target[data-focus="cam"] .r3d-layer[data-layer="cam"],
  .rest-target[data-focus="wifi"] .r3d-layer[data-layer="wifi"],
  .rest-target[data-focus="tab"] .r3d-layer[data-layer="tab"],
  .rest-target[data-focus="in"] .r3d-layer[data-layer="in"],
  .rest-target[data-focus="lanes"] .r3d-layer[data-layer="lanes"],
  .rest-target[data-focus="gear"] .r3d-layer[data-layer="gear"] { opacity: 1; transform: translateZ(calc(var(--z) * var(--step) + 3cqw)); }

  /* ───────────────────────── TARGET's signature: the signal. Once the three layers have lifted (.is-done), a pulse of light runs
     camera > Wi-Fi/LAN > tablet, and the tablet pings, three times, then rests. Lime is light, on dark. Static with reduced motion.
     The pulse and the ping are small HTML pills and a ring (not SVG strokes): they move by transform and opacity only, so the
     compositor runs them and nothing on the main thread repaints (a stroke-dashoffset on an SVG path re-rasterises the whole
     layer every frame). Each pulse is three separate runs, so the page is not ticking an animation between them. The pill's
     path is the network layer's dashed curve, sampled in app units: 1 unit = --u (the viewBox's 160 across the card's width). ───────────────────────── */
  .rest-plan .r3d-tilt { --u: calc(var(--w) / 160); }
  .pl-dot {
    position: absolute; left: calc(50% - var(--l) * var(--u) / 2); top: calc(50% - 0.55 * var(--u)); width: calc(var(--l) * var(--u)); height: calc(1.1 * var(--u));
    border-radius: 999px; background: var(--color-lime); opacity: 0; pointer-events: none;
  }
  .pl-dot-1 { --l: 3.4; }
  .pl-dot-2 { --l: 6.2; }
  .pl-ring {
    position: absolute; left: calc(50% + 33 * var(--u)); top: calc(50% + 49 * var(--u)); width: calc(6 * var(--u)); aspect-ratio: 1;
    border-radius: 50%; border: calc(0.5 * var(--u)) solid var(--color-lime); opacity: 0; pointer-events: none; box-sizing: border-box;
  }
  @keyframes pl-run-1 {
    0% { transform: translate(-11.88cqw, -33.75cqw) rotate(139.8deg); opacity: 0; }
    6.25% { transform: translate(-13.85cqw, -32.02cqw) rotate(137.8deg); opacity: .78; }
    12.5% { transform: translate(-15.70cqw, -30.27cqw) rotate(135.6deg); opacity: 1; }
    18.75% { transform: translate(-17.44cqw, -28.51cqw) rotate(133.4deg); opacity: 1; }
    25% { transform: translate(-19.06cqw, -26.72cqw) rotate(131.0deg); opacity: 1; }
    31.25% { transform: translate(-20.57cqw, -24.91cqw) rotate(128.5deg); opacity: 1; }
    37.5% { transform: translate(-21.95cqw, -23.09cqw) rotate(125.9deg); opacity: 1; }
    43.75% { transform: translate(-23.22cqw, -21.24cqw) rotate(123.1deg); opacity: 1; }
    50% { transform: translate(-24.38cqw, -19.38cqw) rotate(120.3deg); opacity: 1; }
    56.25% { transform: translate(-25.41cqw, -17.49cqw) rotate(117.3deg); opacity: 1; }
    62.5% { transform: translate(-26.33cqw, -15.59cqw) rotate(114.2deg); opacity: 1; }
    68.75% { transform: translate(-27.13cqw, -13.66cqw) rotate(111.0deg); opacity: 1; }
    75% { transform: translate(-27.81cqw, -11.72cqw) rotate(107.7deg); opacity: 1; }
    81.25% { transform: translate(-28.38cqw, -9.76cqw) rotate(104.4deg); opacity: 1; }
    87.5% { transform: translate(-28.83cqw, -7.77cqw) rotate(101.1deg); opacity: 1; }
    93.75% { transform: translate(-29.16cqw, -5.77cqw) rotate(97.7deg); opacity: .78; }
    100% { transform: translate(-29.38cqw, -3.75cqw) rotate(94.4deg); opacity: 0; }
  }
  @keyframes pl-run-2 {
    0% { transform: translate(-27.41cqw, -4.46cqw) rotate(-1.3deg); opacity: 0.00; }
    6.25% { transform: translate(-24.97cqw, -4.47cqw) rotate(0.8deg); opacity: 0.78; }
    12.5% { transform: translate(-20.91cqw, -4.29cqw) rotate(4.5deg); opacity: 1.00; }
    18.75% { transform: translate(-16.86cqw, -3.83cqw) rotate(8.4deg); opacity: 1.00; }
    25% { transform: translate(-12.86cqw, -3.10cqw) rotate(12.3deg); opacity: 1.00; }
    31.25% { transform: translate(-8.92cqw, -2.09cqw) rotate(16.5deg); opacity: 1.00; }
    37.5% { transform: translate(-5.06cqw, -0.80cqw) rotate(20.7deg); opacity: 1.00; }
    43.75% { transform: translate(-1.31cqw, 0.79cqw) rotate(25.1deg); opacity: 1.00; }
    50% { transform: translate(2.30cqw, 2.66cqw) rotate(29.7deg); opacity: 1.00; }
    56.25% { transform: translate(5.75cqw, 4.81cqw) rotate(34.3deg); opacity: 1.00; }
    62.5% { transform: translate(9.01cqw, 7.25cqw) rotate(39.2deg); opacity: 1.00; }
    68.75% { transform: translate(12.05cqw, 9.96cqw) rotate(44.3deg); opacity: 1.00; }
    75% { transform: translate(14.83cqw, 12.93cqw) rotate(49.6deg); opacity: 1.00; }
    81.25% { transform: translate(17.31cqw, 16.15cqw) rotate(55.1deg); opacity: 1.00; }
    87.5% { transform: translate(19.46cqw, 19.60cqw) rotate(61.1deg); opacity: 1.00; }
    93.75% { transform: translate(21.23cqw, 23.26cqw) rotate(67.6deg); opacity: 0.78; }
    100% { transform: translate(22.56cqw, 27.11cqw) rotate(74.5deg); opacity: 0.00; }
  }
  @keyframes pl-ping { 0%, 43% { transform: scale(0.8); opacity: 0; } 44% { opacity: 0.9; } 62%, 100% { transform: scale(3.2); opacity: 0; } }
  @media (prefers-reduced-motion: no-preference) {
    .app-rest.is-done .pl-dot-1 { animation: pl-run-1 864ms linear 0ms 1, pl-run-1 864ms linear 3600ms 1, pl-run-1 864ms linear 7200ms 1; }
    .app-rest.is-done .pl-dot-2 { animation: pl-run-2 864ms linear 700ms 1, pl-run-2 864ms linear 4300ms 1, pl-run-2 864ms linear 7900ms 1; }
    .app-rest.is-done .pl-ring { animation: pl-ping 3600ms var(--ease-out) 0ms 3 both; }
    /* off screen it waits (app-page.js sets .is-away) and picks up where it was */
    .app-rest.is-away .pl-dot, .app-rest.is-away .pl-ring { animation-play-state: paused; }
  }

  /* ───────────────────────── The closing call: a lead line above the badges and one line of help under them ───────────────────────── */
  .store-row .store-lead { flex: 1 0 100%; margin-bottom: var(--space-1); color: var(--text); font-size: var(--type-lede-size); line-height: var(--type-lede-leading); text-align: center; text-shadow: 0 0 14px var(--color-night), 0 0 6px var(--color-night), 0 0 2px var(--color-night); }
  .footer-cta .cta-help { max-width: 40ch; color: var(--text-muted); text-wrap: balance; text-shadow: 0 0 14px var(--color-night), 0 0 6px var(--color-night), 0 0 2px var(--color-night); }
  /* a 44 px touch target for a link inside a sentence: the padding is cancelled by the margin, so the line does not grow */
  .footer-cta .cta-help a { display: inline-block; padding-block: 0.75em; margin-block: -0.75em; color: var(--text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.25em; transition: color var(--duration-hover) var(--ease-hover); }
  @media (hover: hover) and (pointer: fine) { .footer-cta .cta-help a:hover { color: var(--accent-text, var(--color-lime)); } }
  .footer-cta .cta-help a:focus-visible { color: var(--accent-text, var(--color-lime)); }
}
