/* The dedicated edition's personalisation, shown on a model of the box rather than listed.

   The model is CSS 3D, like the deck above it: every block is a box of six faces sized in millimetres
   from BoxCatalog (the view writes the numbers as --w/--h/--d and the position as --x/--y/--z), and
   one variable, --mm, says how many pixels a millimetre is on this screen — so the model is the box
   seen nearer or further away, never a different box. The oak is the joiner's photograph of the wood,
   and the light is painted per face: the top takes the most, the front less, the side the least. */

/* #region Section */
.alibi-personal {
    position: relative;
    overflow: hidden;
    padding: 15vh 0;
    background: var(--black);
    border-bottom: 1px solid var(--line);
}

/* Both columns from the top, never centred on each other: the list opens and closes as the places
   change, and a model centred on it moved up and down with every place. The model holds still beside
   the list instead, pinned under the site's bar while the section scrolls. */
.alibi-personal-grid {
    display: grid;
    grid-template-columns: minmax(18rem, .82fr) minmax(0, 1.18fr);
    align-items: start;
    gap: clamp(3rem, 6vw, 8rem);
    width: min(90vw, var(--hero-content-max));
    max-width: none;
    margin-inline: auto;
    padding-inline: 0;
}

.alibi-personal-copy {
    position: relative;
    z-index: 2;
}

    .alibi-personal-copy h2 {
        margin: 1.7rem 0 2rem;
        color: var(--white);
        font-family: var(--font-display);
        font-size: clamp(3rem, 5vw, 6.2rem);
        font-weight: 300;
        line-height: .94;
        letter-spacing: -.045em;
    }

        .alibi-personal-copy h2 i {
            color: var(--gold);
            font-weight: 300;
        }

.alibi-personal-lead {
    max-width: 31rem;
    color: var(--text-muted);
    font-size: clamp(1rem, 1.05vw, 1.05rem);
    font-weight: 200;
    line-height: 1.9;
}

.alibi-personal-steps {
    margin: clamp(2.4rem, 4vw, 3.6rem) 0 2.4rem;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--hairline-mid);
}

.alibi-personal-step {
    position: relative;
    border-bottom: 1px solid var(--line);
}

.alibi-personal-pick {
    display: grid;
    grid-template-columns: 3rem 1fr auto;
    gap: 1.2rem;
    align-items: baseline;
    width: 100%;
    padding: 1.1rem 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.alibi-personal-number {
    color: rgba(245, 245, 245, .5);
    font-family: var(--font-mono);
    font-size: .72rem;
    letter-spacing: .12em;
    transition: color .5s var(--ease-house);
}

.alibi-personal-name {
    color: var(--white-faint);
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 1.4vw, 1.4rem);
    font-weight: 300;
    transition: color .5s var(--ease-house);
}

/* Which edition a place belongs to, on every line — the section is about the dedicated edition, and
   the one place every box carries must not read as an extra. */
.alibi-personal-edition {
    color: var(--white-ghost);
    font-family: var(--font-mono);
    font-size: .6rem;
    letter-spacing: .14em;
    text-align: right;
    text-transform: uppercase;
    white-space: nowrap;
}

.alibi-personal-edition--every {
    color: var(--gold);
}

.alibi-personal-pick:hover .alibi-personal-name,
.alibi-personal-pick:focus-visible .alibi-personal-name,
.alibi-personal-step.is-current .alibi-personal-name {
    color: var(--white);
}

.alibi-personal-step.is-current .alibi-personal-number {
    color: var(--gold);
}

/* Only the place being shown says what it is; the others stay one line each, so the list reads as the
   five places at a glance and the model, not the text, carries the moment. */
/* A plain block: in a grid every run of text and every ™ (site.js marks it up as an element) became a row
   of its own, and „Soul™" broke from its full stop. */
.alibi-personal-body {
    display: block;
    max-height: 0;
    margin: 0;
    padding-left: 4.2rem;
    overflow: hidden;
    color: var(--text-muted);
    font-size: .98rem;
    font-weight: 200;
    line-height: 1.75;
    opacity: 0;
    transition: max-height .7s var(--ease-house), opacity .5s var(--ease-house), padding .7s var(--ease-house);
}

.alibi-personal-step.is-current .alibi-personal-body {
    max-height: 9rem;
    padding-bottom: 1.2rem;
    opacity: 1;
}

/* How long this place stays before the next, drawn along the step's own hairline. The bar's animation
   is the clock: the script moves on when it ends, and holding the section pauses it. */
.alibi-personal-progress {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 1px;
    pointer-events: none;
}

    .alibi-personal-progress i {
        display: block;
        height: 100%;
        background: var(--gold);
        transform: scaleX(0);
        transform-origin: left;
    }

.alibi-personal.is-running .alibi-personal-step.is-current .alibi-personal-progress i {
    animation: alibiPersonalRun var(--personal-turn, 6.5s) linear forwards;
}

.alibi-personal.is-held .alibi-personal-step.is-current .alibi-personal-progress i {
    animation-play-state: paused;
}

/* The welcome card stays long enough for its letter to be written out and read. */
.alibi-personal-step[data-personal-step="welcome"] {
    --personal-turn: 13s;
}

@keyframes alibiPersonalRun {
    to { transform: scaleX(1); }
}

.alibi-personal-cta {
    display: inline-flex;
}
/* #endregion */

/* #region The model */
.alibi-model {
    /* Pixels per millimetre. The open poses need about 250 mm of height around a 75 mm box. */
    --mm: clamp(1.45px, calc(.2vw + .8px), 2.9px);
    --oak: url('/img/joiner/oak.webp');
    --oak-size: calc(130 * var(--mm));
    --engraved: rgba(52, 31, 14, .82);
    --turn: 1.5s;
    position: sticky;
    top: calc(var(--site-header-h) + 1.5rem);
    display: grid;
    place-items: center;
    aspect-ratio: 1 / 1;
    margin: 0;
    background: radial-gradient(ellipse 58% 52% at 50% 56%, rgba(var(--gold-rgb), .075), transparent 70%);
}

.alibi-model-scene {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    perspective: calc(900 * var(--mm));
    perspective-origin: 50% 35%;
}

.alibi-model-box {
    position: relative;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
    /* Set low in its square: the open lid stands about 110 mm above the box. */
    transform: translateY(calc(42 * var(--mm))) rotateX(-24deg) rotateY(-32deg);
    animation: alibiModelSway 16s ease-in-out infinite alternate;
}

/* The table: the box's shadow, on a pool of light just wide enough to stand it in. */
.alibi-model-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: calc(230 * var(--mm));
    height: calc(230 * var(--mm));
    margin: calc(-115 * var(--mm)) 0 0 calc(-115 * var(--mm));
    background: radial-gradient(closest-side, rgba(0, 0, 0, .95) 0 34%, rgba(var(--gold-rgb), .07) 52%, transparent 100%);
    transform: translateY(calc(var(--box-height) / 2 * var(--mm) + 1px)) rotateX(90deg);
}

@keyframes alibiModelSway {
    from { transform: translateY(calc(42 * var(--mm))) rotateX(-24deg) rotateY(-40deg); }
    to { transform: translateY(calc(42 * var(--mm))) rotateX(-22deg) rotateY(-20deg); }
}

.alibi-model-part,
.alibi-model-lid,
.alibi-model-card {
    position: absolute;
    left: 0;
    top: 0;
    transform-style: preserve-3d;
}

.alibi-model-part {
    transform: translate3d(calc(var(--x) * var(--mm)), calc(var(--y) * var(--mm)), calc(var(--z) * var(--mm)));
}

.alibi-model-face {
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    background: #8C7153 var(--oak) 0 0 / var(--oak-size) auto;
    /* Every face a pixel larger than its block: two faces meeting at an edge are rasterised apart, and
       while the box turned the hairline between them showed the black behind the model. Drawn from the
       front only — the blocks touch, so inside the box faces lie in one plane back to back (the deck on
       the floor, the floor against the walls), and drawn from both sides the browser re-decided at every
       degree of the turn which one was nearer: the edge between the cards and the wood swam. */
    backface-visibility: hidden;
    /* The photograph is warmer than the oiled oak of the box; each face is cooled on its own, because
       a filter on anything holding the 3D would flatten it into a picture. */
    filter: saturate(.72) brightness(1.08);
}

    /* The light, laid over the wood face by face. */
    .alibi-model-face::after {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(5, 5, 5, var(--shade, 0));
        transition: background var(--turn) var(--ease-house);
    }

.alibi-model-face--front,
.alibi-model-face--back {
    width: calc(var(--w) * var(--mm) + 1px);
    height: calc(var(--h) * var(--mm) + 1px);
    margin: calc((var(--h) * var(--mm) + 1px) / -2) 0 0 calc((var(--w) * var(--mm) + 1px) / -2);
}

.alibi-model-face--left,
.alibi-model-face--right {
    width: calc(var(--d) * var(--mm) + 1px);
    height: calc(var(--h) * var(--mm) + 1px);
    margin: calc((var(--h) * var(--mm) + 1px) / -2) 0 0 calc((var(--d) * var(--mm) + 1px) / -2);
}

.alibi-model-face--top,
.alibi-model-face--bottom {
    width: calc(var(--w) * var(--mm) + 1px);
    height: calc(var(--d) * var(--mm) + 1px);
    margin: calc((var(--d) * var(--mm) + 1px) / -2) 0 0 calc((var(--w) * var(--mm) + 1px) / -2);
    background: #8C7153;
}

    /* The grain runs along the length of a board, so a face seen from above takes the photograph
       turned a quarter. */
    .alibi-model-face--top::before,
    .alibi-model-face--bottom::before {
        content: '';
        position: absolute;
        left: 50%;
        top: 50%;
        width: calc(var(--d) * var(--mm));
        height: calc(var(--w) * var(--mm));
        background: var(--oak) 0 0 / var(--oak-size) auto;
        transform: translate(-50%, -50%) rotate(90deg);
    }

.alibi-model-face--front { --shade: .16; transform: translateZ(calc(var(--d) * var(--mm) / 2)); }
.alibi-model-face--back { --shade: .5; transform: rotateY(180deg) translateZ(calc(var(--d) * var(--mm) / 2)); }
.alibi-model-face--left { --shade: .55; transform: rotateY(-90deg) translateZ(calc(var(--w) * var(--mm) / 2)); }
.alibi-model-face--right { --shade: .36; transform: rotateY(90deg) translateZ(calc(var(--w) * var(--mm) / 2)); }
.alibi-model-face--top { --shade: 0; transform: rotateX(90deg) translateZ(calc(var(--h) * var(--mm) / 2)); }
.alibi-model-face--bottom { --shade: .7; transform: rotateX(-90deg) translateZ(calc(var(--h) * var(--mm) / 2)); }

/* Faces no view of the model ever shows — buried against a neighbour or under the box. Left out, they
   cannot contend with the faces that are seen. */
.alibi-model-part--floor .alibi-model-face--left,
.alibi-model-part--floor .alibi-model-face--right,
.alibi-model-part--floor .alibi-model-face--back,
.alibi-model-part--floor .alibi-model-face--bottom,
.alibi-model-part--side .alibi-model-face--front,
.alibi-model-part--side .alibi-model-face--back,
.alibi-model-part--side .alibi-model-face--bottom,
.alibi-model-part--back .alibi-model-face--bottom,
.alibi-model-part--front .alibi-model-face--bottom,
.alibi-model-part--stack .alibi-model-face--bottom {
    display: none;
}

/* The inside of a wall is in the box's own shadow. */
.alibi-model-part--back .alibi-model-face--front,
.alibi-model-part--front .alibi-model-face--back {
    --shade: .58;
}

.alibi-model-part--floor .alibi-model-face--top {
    --shade: .6;
}

/* A hundred black cards: the stock dyed through, the edge a fine stripe of sheets. */
.alibi-model-part--stack .alibi-model-face {
    background: repeating-linear-gradient(to bottom, #0d0d0d 0 1px, #1a1a1a 1px 2px);
}

    .alibi-model-part--stack .alibi-model-face--top,
    .alibi-model-part--stack .alibi-model-face--bottom {
        background: #0b0b0b;
    }

        .alibi-model-part--stack .alibi-model-face--top::before,
        .alibi-model-part--stack .alibi-model-face--bottom::before {
            content: none;
        }

/* #region The lid */
/* The lid turns on its back lower edge, the way a hand lifts it off its magnets: whatever angle it is
   at on the way, it is above the box or behind it, never through it. Every pose writes the same two
   functions, so the browser turns the angle rather than inventing a path between two matrices. */
.alibi-model-lid {
    transform: translate3d(0, calc(var(--y) * var(--mm)), 0) rotateX(0deg);
    transform-origin: 0 calc(var(--h) * var(--mm) / 2) calc(var(--d) * var(--mm) / -2);
    transition: transform var(--turn) var(--ease-house);
}

    .alibi-model-lid .alibi-model-face {
        transition: opacity var(--turn) var(--ease-house);
    }

.alibi-model-engraving {
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: calc(var(--w) * var(--mm));
    height: calc(var(--d) * var(--mm));
    margin: calc(var(--d) * var(--mm) / -2) 0 0 calc(var(--w) * var(--mm) / -2);
    backface-visibility: hidden;
    transition: opacity var(--turn) var(--ease-house);
}

.alibi-model-engraving--top {
    transform: rotateX(90deg) translateZ(calc(var(--h) * var(--mm) / 2 + .5px));
}

.alibi-model-engraving--under {
    transform: rotateX(-90deg) translateZ(calc(var(--h) * var(--mm) / 2 + .5px));
}

/* The owner's mark, as a stand-in: a sign turning from one shape into the next (the view's Mark).
   Burnt into the oak on the lid, gilded on the cards. */
.alibi-model-mark {
    display: block;
    width: calc(34 * var(--mm));
    height: calc(34 * var(--mm));
    overflow: visible;
    color: var(--engraved);
}

    .alibi-model-mark path {
        fill: none;
        stroke: currentColor;
        stroke-linejoin: round;
        vector-effect: non-scaling-stroke;
    }

    .alibi-model-mark .alibi-model-mark-outer {
        stroke-width: calc(1.5 * var(--mm));
    }

    .alibi-model-mark .alibi-model-mark-inner {
        stroke-width: calc(.9 * var(--mm));
        opacity: .85;
    }

    .alibi-model-mark .alibi-model-mark-centre {
        fill: currentColor;
    }

/* A laser burns a little dark into the grain; a soft second stroke under the line is that scorch. */
.alibi-model-mark--engraved {
    filter: drop-shadow(0 0 calc(.6 * var(--mm)) rgba(60, 34, 12, .45));
}

.alibi-model-mark--gilded {
    color: var(--gold);
    filter: drop-shadow(0 0 calc(1.6 * var(--mm)) rgba(var(--gold-rgb), .45));
}

.alibi-model-dedication {
    max-width: calc(64 * var(--mm));
    color: rgba(38, 21, 8, .92);
    font-family: var(--font-display);
    font-size: calc(7 * var(--mm));
    font-style: italic;
    line-height: 1.3;
    text-align: center;
}

/* The Soul chip in the lid's core: a gold disc that only shows once the oak is seen through. */
.alibi-model-chip {
    position: absolute;
    left: 0;
    top: 0;
    width: calc(var(--chip) * var(--mm));
    height: calc(var(--chip) * var(--mm));
    margin: calc(var(--chip) * var(--mm) / -2) 0 0 calc(var(--chip) * var(--mm) / -2);
    border-radius: 50%;
    background:
        radial-gradient(circle, transparent 0 30%, rgba(5, 5, 5, .5) 31% 33%, transparent 34% 46%, rgba(5, 5, 5, .5) 47% 49%, transparent 50%),
        radial-gradient(circle at 35% 30%, var(--gold-bright), var(--gold) 60%, #7d6f45);
    box-shadow: 0 0 calc(10 * var(--mm)) rgba(var(--gold-rgb), .6);
    opacity: 0;
    transform: rotateX(90deg);
    transition: opacity var(--turn) var(--ease-house);
}

    /* What the chip answers a phone with, drawn as rings leaving it. */
    .alibi-model-chip i {
        position: absolute;
        inset: 0;
        border: 1px solid var(--gold);
        border-radius: 50%;
        opacity: 0;
    }
/* #endregion */

/* #region The card */
.alibi-model-card {
    transform: translate3d(0, calc(var(--y) * var(--mm)), 0) rotateX(90deg);
    transition: transform var(--turn) var(--ease-house);
}

.alibi-model-card-face {
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: calc(6 * var(--mm));
    width: calc(var(--w) * var(--mm));
    height: calc(var(--d) * var(--mm));
    margin: calc(var(--d) * var(--mm) / -2) 0 0 calc(var(--w) * var(--mm) / -2);
    border: 1px solid rgba(var(--gold-rgb), .22);
    border-radius: calc(3 * var(--mm));
    background: radial-gradient(circle at 50% 42%, #161616, #090909 70%);
    backface-visibility: hidden;
}

.alibi-model-card-face--welcome {
    transform: rotateY(180deg);
}

.alibi-model-card-signet {
    width: calc(7 * var(--mm));
    height: auto;
}

/* The welcome card's letter. Everything printed on a card of this deck is gilded, the letter too. */
.alibi-model-letter {
    display: grid;
    justify-items: center;
    gap: calc(3.2 * var(--mm));
    max-width: calc(48 * var(--mm));
    min-height: calc(46 * var(--mm));
    align-content: start;
    color: var(--gold);
    font-family: var(--font-display);
    text-align: center;
    text-shadow: 0 0 calc(1.6 * var(--mm)) rgba(var(--gold-rgb), .28);
}

.alibi-model-welcome {
    font-size: calc(5 * var(--mm));
    font-style: italic;
    line-height: 1.2;
}

.alibi-model-letter-body {
    font-size: calc(3.5 * var(--mm));
    line-height: 1.5;
}

.alibi-model-letter-signature {
    font-size: calc(3.3 * var(--mm));
    font-style: italic;
    opacity: .85;
}

/* The pen while the letter is being written: a gilded caret after the last letter. */
.alibi-model-caret {
    display: inline-block;
    width: 1px;
    height: 1em;
    margin-left: 1px;
    background: currentColor;
    vertical-align: -.12em;
    animation: alibiModelCaret .9s steps(1) infinite;
}

@keyframes alibiModelCaret {
    50% { opacity: 0; }
}
/* #endregion */

/* #region The poses */
/* Under the lid: lifted a little off its magnets and opened towards the back, its underside turned to
   the visitor — and lit, since the face that was in the box's shadow is now the one held to the light. */
.alibi-model[data-step="dedication"] .alibi-model-lid {
    transform: translate3d(0, calc((var(--y) - 3) * var(--mm)), 0) rotateX(106deg);
}

.alibi-model[data-step="dedication"] .alibi-model-part--lid .alibi-model-face--bottom,
.alibi-model[data-step="reverse"] .alibi-model-part--lid .alibi-model-face--bottom,
.alibi-model[data-step="welcome"] .alibi-model-part--lid .alibi-model-face--bottom {
    --shade: .06;
}

/* The card: the lid laid right back, out of the way behind the box, and the top card raised out of it.
   The card waits for the lid to clear the opening before it rises... */
.alibi-model[data-step="reverse"] .alibi-model-lid,
.alibi-model[data-step="welcome"] .alibi-model-lid {
    transform: translate3d(0, calc((var(--y) - 3) * var(--mm)), 0) rotateX(172deg);
}

.alibi-model[data-step="reverse"] .alibi-model-card {
    transform: translate3d(0, calc((var(--y) - 62) * var(--mm)), calc(22 * var(--mm))) rotateX(18deg);
    transition-delay: .55s;
}

.alibi-model[data-step="welcome"] .alibi-model-card {
    transform: translate3d(0, calc((var(--y) - 62) * var(--mm)), calc(22 * var(--mm))) rotateX(18deg) rotateY(180deg);
    transition-delay: .55s;
}

/* ...and on the way back the card goes home first and the lid closes over it after. */
.alibi-model[data-step="lid"] .alibi-model-lid,
.alibi-model[data-step="soul"] .alibi-model-lid {
    transition-delay: .5s;
}

/* The chip: the lid back on, and the oak let go transparent so what lives in it shows. */
.alibi-model[data-step="soul"] .alibi-model-lid .alibi-model-face,
.alibi-model[data-step="soul"] .alibi-model-engraving--top {
    opacity: .22;
}

.alibi-model[data-step="soul"] .alibi-model-chip {
    opacity: 1;
}

/* The card under the lid would show its gilding through the oak beside the chip — two gold circles
   where the place being shown is one. */
.alibi-model-card-face .alibi-model-mark {
    transition: opacity var(--turn) var(--ease-house);
}

.alibi-model[data-step="soul"] .alibi-model-card-face .alibi-model-mark {
    opacity: .08;
}

    .alibi-model[data-step="soul"] .alibi-model-chip i {
        animation: alibiModelSignal 2.7s var(--ease-house) infinite;
    }

        .alibi-model[data-step="soul"] .alibi-model-chip i:nth-child(2) {
            animation-delay: .9s;
        }

        .alibi-model[data-step="soul"] .alibi-model-chip i:nth-child(3) {
            animation-delay: 1.8s;
        }

@keyframes alibiModelSignal {
    from { opacity: .9; transform: scale(1); }
    to { opacity: 0; transform: scale(2.8); }
}

/* #endregion */
/* #endregion */

/* #region Narrow screens */
@media (max-width: 950px) {
    .alibi-personal-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    /* The model belongs between the lead and the list it illustrates, so the copy's own box steps
       aside and its children take their places in the grid. */
    .alibi-personal-copy {
        display: contents;
    }

        .alibi-personal-copy > * {
            order: 1;
        }

    .alibi-model {
        position: relative;
        top: auto;
        order: 2;
        width: min(100%, 34rem);
        margin: 1rem auto 0;
    }

    .alibi-personal-steps {
        order: 3;
        margin-top: 1rem;
    }

    .alibi-personal-cta {
        order: 4;
        justify-self: start;
    }
}
/* #endregion */

/* #region Reduced motion */
/* No sway, no turn and no clock: the places change at once when chosen, and nothing changes unless it
   is chosen. */
@media (prefers-reduced-motion: reduce) {
    .alibi-model {
        --turn: 0s;
    }

    .alibi-model-box {
        animation: none;
    }

    .alibi-personal-progress,
    .alibi-model-chip i {
        display: none;
    }

    .alibi-personal-body {
        transition: none;
    }
}
/* #endregion */
