/* Storyboard: Brandon Schembri's career as a hand-drawn storyboard sheet. */

:root {
    --ink: #2b2b2e;
    --paper: #fbfbf8;
    --ground: #cfd2d6;
    --yellow: #ffe94a;
    --red: #e0452f;
    --red-dark: #c7351f;
    --blue: #5b8fd9;
    --green: #2c9a57;
    --gutter: 0px; /* the sheet fills the whole screen; raise this to bring back the grey desk around it */
}

html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); }
a { color: var(--ink); }
a:hover { color: var(--red); }

/* ---------- Ground and sheet ---------- */
.sb-ground {
    min-height: 100vh;
    box-sizing: border-box;
    padding: var(--gutter);
    background: var(--ground);
    color: var(--ink);
    font-family: 'Courier Prime', 'Courier New', monospace;
    display: flex;
}
.sb-defs { position: absolute; }

.sb-sheet {
    flex: 1;
    min-width: 0;
    min-height: calc(100vh - 2 * var(--gutter));
    box-sizing: border-box;
    background: var(--paper);
    padding: clamp(18px, 2.2vw, 30px) clamp(16px, 3vw, 44px) clamp(16px, 1.8vw, 24px);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---------- Header ---------- */
/* Desktop: name on the left, resume note and photo grouped on the right, all centred on one line. */
.sb-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "title resume photo";
    align-items: center;
    gap: 14px clamp(20px, 2.6vw, 40px);
}
.sb-title { grid-area: title; }
.sb-resume { grid-area: resume; }
.sb-polaroid { grid-area: photo; }

/* Title: pencil lettering, outlined and hatched */
.sb-title { display: flex; flex-direction: column; gap: clamp(5px, .6vw, 9px); min-width: 0; }
.sb-title h1 {
    position: relative;
    align-self: flex-start;
    margin: 0;
    font-family: 'Archivo Black', 'Arial Black', 'Arial Bold', Impact, 'Helvetica Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(22px, 6.6vw, 34px);
    line-height: 1.1;
    letter-spacing: .03em;
    text-transform: uppercase;
    white-space: nowrap;
    color: transparent;
    -webkit-text-stroke: .045em var(--ink);
    background: repeating-linear-gradient(-45deg, rgba(43, 43, 46, .85) 0 .034em, rgba(43, 43, 46, 0) .034em .14em);
    -webkit-background-clip: text;
    background-clip: text;
    animation: sb-boil .54s steps(1) infinite;
}
.sb-tagline {
    margin-left: .15em;
    font-weight: 700;
    font-size: clamp(12px, 1.08vw, 15.5px);
    letter-spacing: .1em;
    color: var(--red-dark);
}
@media (min-width: 640px) {
    .sb-title h1 { font-size: clamp(30px, 4.6vw, 50px); }
}
@media (min-width: 1100px) {
    .sb-title h1 { font-size: clamp(44px, 4vw, 58px); }
}
@media (prefers-reduced-motion: reduce) {
    .sb-title h1 { animation: none; }
}

/* Resume link: a yellow note stuck on the sheet */
.sb-resume {
    display: flex;
    align-items: center;
    gap: 13px;
    position: relative;
    min-height: 48px;
    box-sizing: border-box;
    padding: 9px 20px 9px 15px;
    border: 2.4px solid var(--ink);
    border-radius: 255px 14px 225px 14px / 14px 225px 14px 255px;
    background: var(--yellow);
    color: var(--ink);
    text-decoration: none;
    box-shadow: 3px 4px 0 rgba(43, 43, 46, .2);
    transform: rotate(-2deg);
    transition: transform .3s cubic-bezier(.3, 1.4, .5, 1), box-shadow .3s;
}
.sb-resume:hover,
.sb-resume:focus-visible {
    color: var(--ink);
    transform: rotate(1.5deg) scale(1.05);
    box-shadow: 5px 7px 0 rgba(43, 43, 46, .22);
}
.sb-resume:focus-visible { outline: 2px dashed var(--ink); outline-offset: 4px; }
.sb-resume svg {
    flex: none;
    fill: none;
    stroke: var(--ink);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sb-resume-doc { width: 29px; height: 36px; fill: var(--paper) !important; }
.sb-resume-lines { stroke: var(--blue); }
.sb-resume-text { display: flex; flex-direction: column; gap: 3px; }
.sb-resume-key { font-weight: 700; font-size: 11.5px; letter-spacing: .08em; }
.sb-resume-val { font: 400 24px/1 'Patrick Hand', cursive; white-space: nowrap; }
.sb-resume-arrow { width: 17px; height: 21px; stroke: var(--red-dark) !important; stroke-width: 2.6 !important; }
.sb-resume:hover .sb-resume-arrow { animation: sb-resume-nudge .6s ease-in-out infinite; }
@keyframes sb-resume-nudge {
    0% { transform: translateY(0); }
    50% { transform: translateY(4px); }
    100% { transform: translateY(0); }
}

/* ---------- Top-right: taped-on photo ---------- */
.sb-sheet { position: relative; }
.sb-polaroid {
    position: relative;
    z-index: 2;
    align-self: start;
    margin: 0 4px 0 0;
    width: 96px;
    box-sizing: border-box;
    padding: 6px 6px 3px;
    background: #ffffff;
    border: 2px solid var(--ink);
    box-shadow: 3px 5px 0 rgba(43, 43, 46, .18);
    transform: rotate(3deg);
    transition: transform .3s cubic-bezier(.3, 1.4, .5, 1);
}
.sb-polaroid:hover { transform: rotate(-2deg) scale(2.2); transform-origin: 100% 0; }
.sb-polaroid img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; }
.sb-polaroid figcaption { padding-top: 3px; text-align: center; font: 400 16px/1.2 'Patrick Hand', cursive; white-space: nowrap; }
.sb-tape {
    position: absolute;
    left: 50%;
    top: -10px;
    width: 42px;
    height: 17px;
    margin-left: -21px;
    background: rgba(255, 233, 74, .82);
    box-shadow: 0 1px 2px rgba(43, 43, 46, .2);
    transform: rotate(-5deg);
}
/* Desktop: the photo is taller than the header row, so it hangs a little below it instead of pushing the frames down */
@media (min-width: 1100px) {
    .sb-polaroid { margin-top: -6px; margin-bottom: -40px; }
}
/* Tablet: name and resume note stacked on the left, photo on the right */
@media (max-width: 1099px) {
    .sb-header {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "title photo" "resume photo";
        align-items: start;
    }
    .sb-resume { justify-self: start; margin-top: 6px; }
}
/* Phone: name across the top, resume note and photo side by side underneath */
@media (max-width: 639px) {
    .sb-header { grid-template-areas: "title title" "resume photo"; align-items: center; }
    .sb-resume { margin-top: 0; }
    .sb-resume-val { font-size: 21px; }
    .sb-polaroid { width: 78px; justify-self: end; }
}
@media (prefers-reduced-motion: reduce) {
    .sb-polaroid { transition: none; }
}

/* ---------- Frame grid ---------- */
.sb-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px 24px;
    align-content: space-evenly;
    padding: 6px 6px 0;
}

.sb-frame {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    min-width: 0;
    opacity: .62;
    transition: transform .35s cubic-bezier(.3, 1.4, .5, 1), opacity .3s;
}
.sb-frame.is-active { opacity: 1; }
.sb-frame:hover,
.sb-frame:focus-visible { transform: rotate(-1deg) scale(1.02); }
.sb-frame:focus { outline: none; }
.sb-frame:focus-visible { outline: 2.5px dashed var(--ink); outline-offset: 10px; }

.sb-box {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    box-sizing: border-box;
    border: 2.6px solid var(--ink);
    border-radius: 255px 14px 225px 14px / 14px 225px 14px 255px;
    background: #ffffff;
    box-shadow: 0 0 0 0 rgba(255, 233, 74, 0);
    transition: box-shadow .3s;
    animation: sb-boil .54s steps(1) infinite;
}
.sb-frame.is-active .sb-box { box-shadow: 0 0 0 7px var(--yellow); }

.sb-box svg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--ink);
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sb-blue { stroke: var(--blue); }
.sb-red { stroke: var(--red); }
.sb-dashed { stroke-dasharray: 5 6; }
.sb-box svg .sb-label { font: 400 11px 'Patrick Hand', cursive; fill: var(--ink); stroke: none; }

/* Drawings stay hidden until storyboard.js has primed the draw-in */
.sb-pre .sb-box svg { visibility: hidden; }

/* ---------- Frame animations: each scene acts itself out when its frame is clicked ---------- */
/* storyboard.js adds .is-acting to the frame for about 2.6s. Every animation ends on the resting drawing. */
.a1-b, .a3-me, .a4-seal, .a4-me, .a4-cap, .a5-lt, .a5-sl, .a5-gt, .a6-card, .a7-plane, .a8-b, .a8-ad, .a8-sun {
    transform-box: fill-box;
    transform-origin: center;
}
.a1-lift, .a2-arm, .a3-b1, .a3-b2, .a5-arms, .a6-arm { transform-box: view-box; }

/* 1 Checkout: one item gets scanned (beep) and bagged, then the belt brings the next one up */
.sb-green { stroke: var(--green); }
.sb-box svg .a1-thin { stroke-width: 1.5; }
.a1-item, .a1-belt, .a1-bag { transform-box: fill-box; transform-origin: center; }
.a1-bag { transform-origin: 50% 100%; }
.a1-arm { transform-box: view-box; transform-origin: 100px 34px; }
.is-acting .a1-item { animation: a1-item 2.4s ease-in-out both; }
.is-acting .a1-arm { animation: a1-arm 2.4s ease-in-out both; }
.is-acting .a1-beep { animation: a1-beep 2.4s steps(1, end) both; }
.is-acting .a1-total { animation: a1-total 2.4s steps(1, end) both; }
.is-acting .a1-bag { animation: a1-bag 2.4s ease-out both; }
.is-acting .a1-belt { animation: a1-belt 2.4s cubic-bezier(.5, 0, .4, 1) both; }
@keyframes a1-item {
    0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
    8% { opacity: 1; transform: translate(0, -2px) rotate(0deg); }
    14% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
    28% { opacity: 1; transform: translate(0, -3px) rotate(0deg); }
    46% { opacity: 1; transform: translate(42px, -8px) rotate(20deg); }
    56% { opacity: 1; transform: translate(42px, 7px) rotate(0deg); }
    60% { opacity: 0; transform: translate(42px, 9px) rotate(0deg); }
    72% { opacity: 0; transform: translate(-14px, -3px) rotate(0deg); }
    76% { opacity: 1; transform: translate(-14px, -3px) rotate(0deg); }
    92% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
    100% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
}
@keyframes a1-arm {
    0% { transform: rotate(0deg); }
    28% { transform: rotate(0deg); }
    46% { transform: rotate(-90deg); }
    56% { transform: rotate(-90deg); }
    76% { transform: rotate(14deg); }
    92% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}
@keyframes a1-beep {
    0% { opacity: 0; }
    8% { opacity: 1; }
    14% { opacity: 0; }
    18% { opacity: 1; }
    27% { opacity: 0; }
    93% { opacity: 1; }
    100% { opacity: 1; }
}
@keyframes a1-total {
    0% { opacity: 1; }
    8% { opacity: 0; }
    14% { opacity: 1; }
    100% { opacity: 1; }
}
@keyframes a1-bag {
    0% { transform: scaleY(1); }
    56% { transform: scaleY(1); }
    61% { transform: scaleY(.9); }
    69% { transform: scaleY(1.05); }
    77% { transform: scaleY(1); }
    100% { transform: scaleY(1); }
}
@keyframes a1-belt {
    0% { opacity: 1; transform: translateX(0); }
    62% { opacity: 1; transform: translateX(0); }
    80% { opacity: 1; transform: translateX(8px); }
    90% { opacity: 1; transform: translateX(8px); }
    94% { opacity: 0; transform: translateX(8px); }
    95% { opacity: 0; transform: translateX(0); }
    100% { opacity: 1; transform: translateX(0); }
}

/* 2 Computer lab: unplug, plug back in, the screen and the tower come back to life */
.a2-arm { transform-origin: 130px 40px; }
.is-acting .a2-cable { stroke-dasharray: 26; animation: a2-cable 2.3s ease-in-out both; }
.is-acting .a2-l1 { animation: a2-l1 2.3s steps(1, end) both; }
.is-acting .a2-l2 { animation: a2-l2 2.3s steps(1, end) both; }
.is-acting .a2-led { animation: a2-led 2.3s steps(1, end) both; }
.is-acting .a2-arm { animation: a2-arm 2.3s ease-in-out both; }
@keyframes a2-cable {
    0% { stroke-dashoffset: 0; }
    14% { stroke-dashoffset: 26; }
    38% { stroke-dashoffset: 26; }
    60% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 0; }
}
@keyframes a2-l1 {
    0% { opacity: 1; }
    14% { opacity: 0; }
    66% { opacity: 1; }
    100% { opacity: 1; }
}
@keyframes a2-l2 {
    0% { opacity: 1; }
    14% { opacity: 0; }
    76% { opacity: 1; }
    100% { opacity: 1; }
}
@keyframes a2-led {
    0% { opacity: 1; }
    14% { opacity: 0; }
    60% { opacity: 1; }
    68% { opacity: 0; }
    76% { opacity: 1; }
    84% { opacity: 0; }
    92% { opacity: 1; }
    100% { opacity: 1; }
}
@keyframes a2-arm {
    0% { transform: rotate(0deg); }
    18% { transform: rotate(-14deg); }
    30% { transform: rotate(10deg); }
    42% { transform: rotate(-14deg); }
    54% { transform: rotate(8deg); }
    66% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

/* 3 Support desk: the questions pop in one after the other */
.a3-me { transform-origin: 50% 100%; }
.a3-b1 { transform-origin: 90px 44px; }
.a3-b2 { transform-origin: 124px 75px; }
.is-acting .a3-b1 { animation: a3-b1 2.2s ease-out both; }
.is-acting .a3-b2 { animation: a3-b2 2.2s ease-out both; }
.is-acting .a3-me { animation: a3-nod 2.2s ease-in-out both; }
@keyframes a3-b1 {
    0% { transform: scale(1); }
    6% { transform: scale(0); }
    20% { transform: scale(0); }
    34% { transform: scale(1.14) rotate(-3deg); }
    44% { transform: scale(1); }
    100% { transform: scale(1); }
}
@keyframes a3-b2 {
    0% { transform: scale(1); }
    6% { transform: scale(0); }
    48% { transform: scale(0); }
    62% { transform: scale(1.14) rotate(3deg); }
    72% { transform: scale(1); }
    100% { transform: scale(1); }
}
@keyframes a3-nod {
    0% { transform: rotate(0deg); }
    30% { transform: rotate(-7deg); }
    45% { transform: rotate(0deg); }
    60% { transform: rotate(7deg); }
    75% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

/* 4 Montage: the certificate writes itself, the seal stamps down, the cap goes up */
.is-acting .a4-l1 { stroke-dasharray: 52; animation: a4-l1 2.5s ease-out both; }
.is-acting .a4-l2 { stroke-dasharray: 52; animation: a4-l2 2.5s ease-out both; }
.is-acting .a4-l3 { stroke-dasharray: 52; animation: a4-l3 2.5s ease-out both; }
.is-acting .a4-seal { animation: a4-seal 2.5s ease-in both; }
.is-acting .a4-me { animation: a4-jump 2.5s ease-out both; }
.is-acting .a4-cap { animation: a4-cap 2.5s ease-out both; }
@keyframes a4-l1 {
    0% { stroke-dashoffset: 52; }
    4% { stroke-dashoffset: 52; }
    20% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 0; }
}
@keyframes a4-l2 {
    0% { stroke-dashoffset: 52; }
    14% { stroke-dashoffset: 52; }
    30% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 0; }
}
@keyframes a4-l3 {
    0% { stroke-dashoffset: 52; }
    24% { stroke-dashoffset: 52; }
    38% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 0; }
}
@keyframes a4-seal {
    0% { opacity: 0; transform: translateY(-30px) scale(1.5); }
    42% { opacity: 0; transform: translateY(-30px) scale(1.5); }
    44% { opacity: 1; transform: translateY(-30px) scale(1.5); }
    56% { opacity: 1; transform: translateY(0) scale(.86); }
    64% { opacity: 1; transform: translateY(0) scale(1.07); }
    70% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes a4-jump {
    0% { transform: translateY(0); }
    68% { transform: translateY(0); }
    79% { transform: translateY(-9px); }
    89% { transform: translateY(0); }
    94% { transform: translateY(-3px); }
    100% { transform: translateY(0); }
}
@keyframes a4-cap {
    0% { transform: translateY(0) rotate(0deg); }
    68% { transform: translateY(0) rotate(0deg); }
    83% { transform: translateY(-25px) rotate(200deg); }
    97% { transform: translateY(0) rotate(360deg); }
    100% { transform: translateY(0) rotate(360deg); }
}

/* 5 Agency: the tag gets typed, one piece at a time */
.a5-arms { transform-origin: 130px 46px; }
.is-acting .a5-lt { animation: a5-lt 2.3s ease-out both; }
.is-acting .a5-sl { animation: a5-sl 2.3s ease-out both; }
.is-acting .a5-gt { animation: a5-gt 2.3s ease-out both; }
.is-acting .a5-arms { animation: a5-type .2s ease-in-out 8 alternate; }
.is-acting .a5-dot { animation: a5-blink .8s steps(1, end) 2 both; }
.is-acting .a5-d2 { animation-delay: .15s; }
.is-acting .a5-d3 { animation-delay: .3s; }
@keyframes a5-lt {
    0% { opacity: 1; transform: scale(1); }
    6% { opacity: 0; transform: scale(.7); }
    18% { opacity: 0; transform: scale(.7); }
    26% { opacity: 1; transform: scale(1.12); }
    32% { opacity: 1; transform: scale(1); }
    80% { opacity: 1; transform: scale(1); }
    88% { opacity: 1; transform: scale(1.15); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes a5-sl {
    0% { opacity: 1; transform: scale(1); }
    6% { opacity: 0; transform: scale(.7); }
    36% { opacity: 0; transform: scale(.7); }
    44% { opacity: 1; transform: scale(1.12); }
    50% { opacity: 1; transform: scale(1); }
    80% { opacity: 1; transform: scale(1); }
    88% { opacity: 1; transform: scale(1.15); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes a5-gt {
    0% { opacity: 1; transform: scale(1); }
    6% { opacity: 0; transform: scale(.7); }
    54% { opacity: 0; transform: scale(.7); }
    62% { opacity: 1; transform: scale(1.12); }
    68% { opacity: 1; transform: scale(1); }
    80% { opacity: 1; transform: scale(1); }
    88% { opacity: 1; transform: scale(1.15); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes a5-type {
    from { transform: rotate(0deg); }
    to { transform: rotate(-9deg); }
}
@keyframes a5-blink {
    0% { opacity: 1; }
    25% { opacity: .15; }
    50% { opacity: 1; }
    100% { opacity: 1; }
}

/* 6 Project manager: a card moves across the board */
.a6-arm { transform-origin: 134px 42px; }
.is-acting .a6-card { animation: a6-card 2.4s cubic-bezier(.5, 0, .3, 1) both; }
.is-acting .a6-arrow { animation: a6-nudge .5s ease-in-out 3; }
.is-acting .a6-arm { animation: a6-arm 2.4s ease-in-out both; }
@keyframes a6-card {
    0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
    10% { opacity: 1; transform: translate(0, -3px) rotate(-5deg); }
    42% { opacity: 1; transform: translate(32px, -3px) rotate(4deg); }
    50% { opacity: 1; transform: translate(32px, 0) rotate(0deg); }
    80% { opacity: 1; transform: translate(32px, 0) rotate(0deg); }
    88% { opacity: 0; transform: translate(32px, 0) rotate(0deg); }
    89% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
    100% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
}
@keyframes a6-nudge {
    0% { transform: translateX(0); }
    50% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}
@keyframes a6-arm {
    0% { transform: rotate(0deg); }
    15% { transform: rotate(-12deg); }
    30% { transform: rotate(6deg); }
    45% { transform: rotate(-12deg); }
    60% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

/* 7 Pacific: the plane flies the whole route from Sydney to New York */
/* Landmarks: Sydney Harbour Bridge on the left, the Empire State Building on the right */
.sb-box svg .a7-thin { stroke-width: 1.4; }
.sb-box svg .a7-sun, .sb-box svg .a7-moon { stroke-width: 1.6; }
.a7-syd, .a7-nyc { transform-box: fill-box; transform-origin: 50% 100%; }
.a7-sun, .a7-moon { transform-box: fill-box; transform-origin: center; }
/* Day in Sydney, night in New York: the sun turns, the moon shows up as the plane arrives */
.is-acting .a7-sun { animation: a7-sun 2.5s ease-in-out both; }
.is-acting .a7-moon { animation: a7-moon 2.5s ease-out both; }
@keyframes a7-sun {
    from { transform: rotate(0deg); }
    to { transform: rotate(90deg); }
}
@keyframes a7-moon {
    0% { opacity: 0; transform: scale(.4); }
    52% { opacity: 0; transform: scale(.4); }
    70% { opacity: 1; transform: scale(1.15); }
    78% { opacity: 1; transform: scale(1); }
    100% { opacity: 1; transform: scale(1); }
}
.is-acting .a7-syd { animation: a7-syd 2.5s ease-out both; }
.is-acting .a7-nyc { animation: a7-nyc 2.5s ease-out both; }
@keyframes a7-syd {
    0% { transform: scaleY(1); }
    6% { transform: scaleY(1.1); }
    14% { transform: scaleY(1); }
    100% { transform: scaleY(1); }
}
@keyframes a7-nyc {
    0% { transform: scaleY(0); }
    50% { transform: scaleY(0); }
    68% { transform: scaleY(1.07); }
    76% { transform: scaleY(1); }
    100% { transform: scaleY(1); }
}
.is-acting .a7-plane { animation: a7-fly 2.5s linear both; }
.is-acting .a7-arc { animation: a7-march 2.5s linear both; }
.is-acting .a7-w1 { animation: a7-wave 2.5s ease-in-out both; }
.is-acting .a7-w2 { animation: a7-wave 2.5s ease-in-out reverse both; }
@keyframes a7-fly {
    0% { opacity: 1; transform: translate(-32px, 37px) rotate(-74deg); }
    20% { opacity: 1; transform: translate(-18px, 9.4px) rotate(-48deg); }
    40% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
    60% { opacity: 1; transform: translate(18px, 9.4px) rotate(48deg); }
    78% { opacity: 1; transform: translate(32px, 37px) rotate(74deg); }
    84% { opacity: 0; transform: translate(32px, 37px) rotate(74deg); }
    85% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
    100% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
}
@keyframes a7-march {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -44; }
}
@keyframes a7-wave {
    0% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
    100% { transform: translateX(0); }
}

/* 8 New York: the skyline goes up, then the creative lands on the billboard in each format */
.a8-b { transform-origin: 50% 100%; }
.is-acting .a8-b { animation: a8-rise .6s cubic-bezier(.3, 1.4, .5, 1) backwards; }
.is-acting .a8-b2 { animation-delay: .12s; }
.is-acting .a8-b3 { animation-delay: .24s; }
.is-acting .a8-b4 { animation-delay: .36s; }
.is-acting .a8-b5 { animation-delay: .48s; }
.is-acting .a8-ad { animation: a8-ad .4s ease-out backwards; }
.is-acting .a8-ad1 { animation-delay: 1s; }
.is-acting .a8-ad2 { animation-delay: 1.25s; }
.is-acting .a8-ad3 { animation-delay: 1.5s; }
.is-acting .a8-sun { animation: a8-sun 1s ease-out .2s backwards; }
@keyframes a8-rise {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}
@keyframes a8-ad {
    0% { opacity: 0; transform: scale(.5); }
    70% { opacity: 1; transform: scale(1.15); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes a8-sun {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.sb-num {
    position: absolute;
    left: -9px;
    top: -11px;
    width: 30px;
    height: 30px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2.4px solid var(--ink);
    background: var(--yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    font: 400 18px 'Patrick Hand', cursive;
}
.sb-slug { font: 700 11.5px/1.3 'Courier Prime', 'Courier New', monospace; text-transform: uppercase; }
.sb-action { font: 400 17px/1.2 'Patrick Hand', cursive; }

/* ---------- Footer ---------- */
.sb-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 28px;
    align-items: center;
    justify-content: space-between;
    border-top: 2px solid var(--ink);
    padding-top: 12px;
}
.sb-bar { display: contents; }
/* Playback controls hidden for now (JS still runs; remove display:none to bring them back) */
.sb-controls { display: none; align-items: center; gap: 14px; }

.sb-play {
    width: 54px;
    height: 54px;
    flex: none;
    padding: 0;
    border-radius: 50%;
    border: 2.6px solid var(--ink);
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.sb-play svg { fill: var(--ink); }
.sb-play svg[hidden] { display: none; }
.sb-play:hover,
.sb-play:focus-visible { background: var(--yellow); }
.sb-play:focus { outline: none; }
.sb-play:focus-visible { outline: 2.5px dashed var(--ink); outline-offset: 4px; }

.sb-counter { display: flex; flex-direction: column; gap: 8px; width: clamp(240px, 26vw, 360px); min-width: 0; }
.sb-counter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sb-sc { font-weight: 700; font-size: 12px; letter-spacing: .08em; white-space: nowrap; }
.sb-tc { font-weight: 700; font-size: 11px; letter-spacing: .04em; color: var(--red-dark); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Scrubbable playbar: one cell per scene, yellow fill, red playhead */
.sb-scrub {
    position: relative;
    padding: 9px 0;
    margin: -9px 0;
    cursor: pointer;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}
.sb-scrub.is-dragging { cursor: grabbing; }
.sb-scrub:focus { outline: none; }
.sb-scrub:focus-visible { outline: 2px dashed var(--ink); outline-offset: 2px; }
.sb-scrub-track {
    position: relative;
    display: block;
    height: 12px;
    border: 1.6px solid var(--ink);
    background: var(--paper);
    overflow: hidden;
}
.sb-scrub-track::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(to right, transparent 0 calc(12.5% - 1.6px), var(--ink) calc(12.5% - 1.6px) 12.5%);
}
.sb-scrub-fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--yellow); }
.sb-scrub-head {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 0;
    width: 3px;
    margin-left: -1.5px;
    border-radius: 2px;
    background: var(--red);
    pointer-events: none;
}
.sb-scrub-head::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -5px;
    width: 13px;
    height: 13px;
    margin-left: -6.5px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid var(--ink);
    background: var(--red);
    transition: transform .15s;
}
.sb-scrub:hover .sb-scrub-head::before,
.sb-scrub.is-dragging .sb-scrub-head::before,
.sb-scrub:focus-visible .sb-scrub-head::before { transform: scale(1.3); }

.sb-caption {
    margin: 0;
    flex: 1 1 360px;
    text-align: center;
    font: 400 clamp(20px, 2vw, 27px)/1.15 'Patrick Hand', cursive;
}
.sb-caption span {
    background: linear-gradient(transparent 55%, var(--yellow) 55%);
    padding: 0 6px;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.sb-links { display: flex; flex-wrap: wrap; gap: 4px 20px; font-weight: 700; font-size: 13px; }
.sb-links a { padding: 13px 0; }
.sb-links a:focus-visible { outline: 2px dashed var(--ink); outline-offset: 2px; }

/* ---------- Keyframes ---------- */
@keyframes sb-boil {
    0% { filter: url(#sb-w1); }
    33% { filter: url(#sb-w2); }
    66% { filter: url(#sb-w3); }
    100% { filter: url(#sb-w1); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1099px) {
    .sb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 28px; }
}

@media (max-width: 639px) {
    .sb-grid { grid-template-columns: minmax(0, 1fr); gap: 30px; }
    .sb-sheet { padding-bottom: 0; }

    /* The footer dissolves so its control bar can stick to the bottom of the viewport */
    .sb-footer { display: contents; }
    .sb-links { order: 1; padding-top: 6px; border-top: 2px solid var(--ink); }
    .sb-bar {
        order: 2;
        position: sticky;
        bottom: 0;
        z-index: 5;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin: 0 calc(-1 * clamp(16px, 2.4vw, 34px));
        padding: 10px clamp(16px, 2.4vw, 34px) 12px;
        background: var(--paper);
        border-top: 2px solid var(--ink);
        box-shadow: 0 -6px 16px rgba(43, 43, 46, .08);
    }
    .sb-controls { gap: 12px; }
    .sb-counter { flex: 1 1 auto; width: auto; }
    .sb-sc-pre { display: none; }
    .sb-play { width: 46px; height: 46px; }
    .sb-caption { flex: none; text-align: left; font-size: 20px; min-height: 2.3em; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .sb-box { animation: none; }
    .sb-frame, .sb-box, .sb-play, .sb-scrub-head::before { transition: none; }
}

/* ---------- Custom cursor: a hand-drawn arrow that follows the mouse (built by storyboard.js) ---------- */
/* The real cursor is hidden only once the drawn one is on screen, so nobody is ever left without a pointer. */
html.sb-cursor-on, html.sb-cursor-on * { cursor: none !important; }
.sb-cursor {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    width: 32px;
    height: 32px;
    pointer-events: none;
    opacity: 0;
    transform-origin: 4px 3px; /* the arrow's tip: it leans around the exact point being pointed at */
    will-change: transform;
}
.sb-cursor.is-shown { opacity: 1; }
.sb-cursor svg {
    display: block;
    overflow: visible;
    transform-origin: 4px 3px;
    filter: drop-shadow(1px 2px 0 rgba(43, 43, 46, .2));
    transition: transform .16s cubic-bezier(.3, 1.6, .5, 1);
}
.sb-cursor-arrow {
    fill: var(--paper);
    stroke: var(--ink);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    transition: fill .12s;
}
.sb-cursor.is-over .sb-cursor-arrow { fill: var(--yellow); }
.sb-cursor.is-over svg { transform: scale(1.15) rotate(-7deg); }
.sb-cursor.is-down svg { transform: scale(.84); }
.sb-cursor-spark {
    fill: none;
    stroke: var(--red);
    stroke-width: 2;
    stroke-linecap: round;
    opacity: 0;
    transform-origin: 4px 3px;
}
.sb-cursor.is-click .sb-cursor-spark { animation: sb-cursor-spark .34s ease-out; }
@keyframes sb-cursor-spark {
    0% { opacity: 1; transform: scale(.4); }
    100% { opacity: 0; transform: scale(1.6); }
}
@media print {
    .sb-cursor { display: none; }
}

/* ---------- Play: draggable letters and frames, and stamps (storyboard.js) ---------- */
/* Positions use the separate translate / rotate / scale properties so they never fight the hover transforms. */
.sb-grab { user-select: none; -webkit-user-select: none; touch-action: none; }
.sb-frame.sb-grab, .sb-tagline.sb-grab, .sb-letter { position: relative; }
.sb-grab.is-held { scale: 1.05; }
.sb-frame.is-moved { opacity: 1; } /* a frame that has been moved is solid, so overlapping frames don't show through each other */

/* The name, once split into letters: each letter carries its own outline, hatching and wobble */
.sb-title h1.is-split { background: none; animation: none; }
.sb-letter, .sb-letter-gap { display: inline-block; }
.sb-letter {
    background: repeating-linear-gradient(-45deg, rgba(43, 43, 46, .85) 0 .034em, rgba(43, 43, 46, 0) .034em .14em);
    -webkit-background-clip: text;
    background-clip: text;
    animation: sb-boil .54s steps(1) infinite;
    transition: scale .15s cubic-bezier(.3, 1.6, .5, 1);
}
.sb-letter:nth-child(3n) { animation-delay: -.18s; }
.sb-letter:nth-child(3n + 1) { animation-delay: -.36s; }
.sb-letter:hover { scale: 1.08; }
.sb-letter.is-held { scale: 1.2; }
.sb-tagline.sb-grab { align-self: flex-start; }

/* Stamps */
.sb-mark {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    animation: sb-slam .32s cubic-bezier(.3, 1.4, .5, 1) backwards;
}
.sb-mark svg { display: block; width: 100%; height: 100%; }
.sb-mark-ok {
    padding: 5px 14px 3px;
    border: 3px solid var(--red-dark);
    outline: 1.5px solid var(--red-dark);
    outline-offset: 3px;
    border-radius: 6px;
    color: var(--red-dark);
    font: 700 19px/1.2 'Courier Prime', 'Courier New', monospace;
    letter-spacing: .1em;
    opacity: .88;
}
.sb-mark-cut { font: 400 40px/1 'Permanent Marker', cursive; }
.sb-mark-star { width: 56px; height: 56px; }
.sb-mark-star path { fill: var(--yellow); stroke: var(--ink); stroke-width: 2.6; stroke-linejoin: round; }
.sb-mark-v {
    width: 54px;
    height: 54px;
    border: 3px solid #3f6fbd;
    border-radius: 50%;
    color: #3f6fbd;
    font: 400 28px/1 'Patrick Hand', cursive;
}
.sb-mark-ring {
    width: 84px;
    height: 84px;
    border: 6px solid rgba(124, 84, 44, .34);
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px rgba(124, 84, 44, .14);
}
.sb-mark-tick { width: 58px; height: 58px; }
.sb-mark-tick path { fill: none; stroke: var(--green, #2c9a57); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.sb-mark-final {
    padding: 3px 10px 1px;
    border: 2.4px solid var(--ink);
    font: 700 17px/1.3 'Courier Prime', 'Courier New', monospace;
    background: var(--paper);
}
@keyframes sb-slam {
    from { transform: scale(2.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .sb-letter, .sb-mark { animation: none; }
}
