/* Shared small-screen adjustments (all pages). */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}

/* Pencil trail (js/pencil-trail.js): drawn on a canvas behind the page content. The page's own
   beige fill moves to the body (same colour) so the trail shows on the background. */
.pencil-trail{position:fixed;left:0;top:0;width:100vw;height:100vh;pointer-events:none;z-index:0}
.pencil-trail-top{z-index:2}  /* the copy drawn over the data page's sticky bar (clipped to its blank sides) */
#app{position:relative;z-index:1}

/* The name plate on Creative Direction / Data Analytics links home and looks unchanged */
.cc-name-link{color:inherit;text-decoration:none;font:inherit;letter-spacing:inherit}
.cc-name-link:focus-visible{outline:1.5px dashed currentColor;outline-offset:6px}
/* Cursors (js/pencil-trail.js sets the classes; links and buttons keep the page's hand-drawn hand):
   - beige background: the pencil (press and drag to draw)
   - right beside / over lines of text: a hand-drawn text cursor (press to select text)
   - photos, videos, charts, panels: the hand-drawn arrow (each page's default) */
html.pt-paper,html.pt-paper body{cursor:url(../assets/ui/pencil-cursor.svg) 2 24,auto}
html.pt-text,html.pt-text body{cursor:url(../assets/ui/text-cursor.svg) 8 12,text}
html.pt-drawing,html.pt-drawing *{cursor:url(../assets/ui/pencil-cursor.svg) 2 24,auto !important;user-select:none;-webkit-user-select:none}
/* Eraser mode (the toggle): the pencil turned around, eraser end first */
html.pt-eraser.pt-paper,html.pt-eraser.pt-paper body{cursor:url(../assets/ui/eraser-cursor.svg) 2 24,auto}
html.pt-eraser.pt-drawing,html.pt-eraser.pt-drawing *{cursor:url(../assets/ui/eraser-cursor.svg) 2 24,auto !important}

/* Pencil / eraser toggle: fixed in the lower-left corner of every page (computers with a mouse only;
   js/pencil-trail.js adds it). A sketched pill with a pastel knob that slides behind the chosen tool. */
.pt-tools{
  position:fixed;left:18px;bottom:18px;z-index:60;display:flex;align-items:center;gap:2px;padding:4px;
  background:#f4f1ec;border:1.5px solid #3f3d3a;
  border-radius:26px 22px 28px 21px / 22px 27px 21px 26px;
  box-shadow:2px 3px 0 rgba(63,61,58,.16);
  cursor:url(../assets/d8555869fa8faa2a2a1b65d72538eda6.svg) 11 2,pointer
}
.pt-tool{
  position:relative;z-index:1;display:flex;align-items:center;justify-content:center;width:40px;height:36px;padding:0;
  background:none;border:0;border-radius:50%;cursor:inherit;-webkit-tap-highlight-color:transparent
}
.pt-tool img{width:26px;height:26px;display:block;pointer-events:none;transition:transform .25s cubic-bezier(.3,1.5,.5,1)}
.pt-tool[aria-pressed="false"] img{opacity:.55}
.pt-tool[aria-pressed="true"] img{transform:rotate(-6deg) scale(1.06)}
.pt-tool:focus-visible{outline:1.5px dashed #3f3d3a;outline-offset:1px}
.pt-knob{
  position:absolute;z-index:0;top:4px;left:4px;width:40px;height:36px;
  background:#f7e2a3;border:1.2px solid #3f3d3a;
  border-radius:21px 18px 22px 17px / 18px 22px 17px 21px;
  transition:transform .32s cubic-bezier(.3,1.35,.5,1),background-color .2s
}
.pt-tools[data-on="eraser"] .pt-knob{transform:translateX(42px);background:#f3c9bd}
.pt-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
@media (prefers-reduced-motion:reduce){.pt-knob,.pt-tool img{transition:none}}
#app > div{background:transparent !important}  /* the page root: its beige is the same as the body's */
/* Phones: the name plate (brackets + HENRY SLATER) scales with the screen width.
   Scale factor = (screen width - 40px) / 443px, the plate's desktop width.
   The name is set slightly smaller than a straight scale so it always sits
   well inside the brackets. */
@media (max-width:600px){
  /* Brackets drawn tighter around the name: half the side space it had (0.9 x the name's scale width) */
  header{
    width:min(calc((100vw - 40px) * .9), 424px) !important;max-width:none !important;
    height:auto !important;aspect-ratio:443 / 126;
    margin-top:26px !important
  }
  .cc-head header{margin-top:10px !important}   /* + the header section's 16px gap */
  header > svg{height:100% !important}
  header h1{
    font-size:min(40px, calc((100vw - 40px) * .080)) !important;
    letter-spacing:min(12px, calc((100vw - 40px) * .022)) !important;
    line-height:1 !important
  }
  /* Keep the name optically centred: its lead-in padding matches the (scaled) letter spacing */
  .cc-name span{padding-left:min(12px, calc((100vw - 40px) * .022)) !important}
  /* Home page name sits on a fixed baseline: centre it in the brackets instead */
  header h1:not(.cc-name){text-indent:min(9.6px, calc((100vw - 40px) * .022)) !important;top:0 !important;bottom:0 !important;display:flex;align-items:center;justify-content:center}
  .hs-nav{gap:0 18px !important;line-height:40px !important;padding-left:12px;padding-right:12px}
}

/* ---- Phone menu: hand-drawn burger + "Menu" ------------------------------ */
.hs-navwrap{display:contents}
.hs-burger{display:none}
@media (max-width:600px){
  /* Burger sits midway between the top of the page and the name plate (33px above, 33px below) */
  /* Upper-left corner, with the burger's left edge lined up with the name plate's left bracket
     (plate is centred and min((100vw - 40px) * .9, 424px) wide; 12px button padding + 3px of art inset) */
  .hs-navwrap{--menu-x:calc((100vw - min((100vw - 40px) * .9, 424px)) / 2 - 15px);
    display:flex;position:relative;justify-content:flex-start;width:100%;box-sizing:border-box;padding:26px 0 0 var(--menu-x);z-index:40}
  .cc-head .hs-navwrap{margin-left:-24px;width:calc(100% + 24px)}  /* these pages' header section adds 24px of side padding */
  .hs-burger{
    display:inline-flex;align-items:center;gap:10px;min-height:48px;padding:4px 12px;
    background:none;border:0;cursor:url(../assets/d8555869fa8faa2a2a1b65d72538eda6.svg) 11 2,pointer;color:#5f5d59;
    font-family:'Jost',sans-serif;font-weight:400;font-size:13px;letter-spacing:3px;text-transform:uppercase;
    -webkit-tap-highlight-color:transparent;animation:hsBurgerIn .9s cubic-bezier(.22,1,.36,1) .5s both
  }
  .hs-burger:focus-visible{outline:1.5px dashed #5f5d59;outline-offset:2px;border-radius:10px}
  .hs-burger-art{width:31px;height:27px;overflow:visible;flex-shrink:0}  /* 20% smaller again (was 39x34) */
  .hs-burger-art g{transform-box:view-box;transition:transform .45s cubic-bezier(.3,1.5,.5,1)}
  .hs-bun-top{transform-origin:30px 25px}
  .hs-burger:active .hs-burger-art{transform:scale(.94)}
  .menu-open .hs-bun-top{transform:translate(1px,-5px) rotate(-8deg)}
  .menu-open .hs-fillings{transform:translateY(-1.5px)}

  /* The menu card */
  .hs-navwrap .hs-nav{
    display:none !important;position:absolute;top:calc(100% + 4px);left:calc(var(--menu-x) + 4px);
    flex-direction:column;align-items:flex-start;text-align:left;gap:0 !important;transform-origin:top left;
    width:max-content;margin:0;padding:12px 28px 12px 28px !important;box-sizing:border-box;  /* card hugs the longest item: equal side margins */
    background:#f4f1ec;border:1.5px solid #5f5d59;
    border-radius:255px 18px 225px 18px / 18px 225px 18px 255px;
    box-shadow:3px 4px 0 rgba(95,93,89,.16);
    font-size:13px !important;line-height:48px !important;letter-spacing:1px
  }
  .menu-open .hs-navwrap .hs-nav{display:flex !important;animation:hsMenuIn .32s cubic-bezier(.22,1,.36,1) both}
  .hs-navwrap .hs-nav a{animation:hsMenuItem .4s cubic-bezier(.22,1,.36,1) both !important}
  .hs-navwrap .hs-nav a:nth-of-type(2){animation-delay:.04s !important}
  .hs-navwrap .hs-nav a:nth-of-type(3){animation-delay:.08s !important}
  .hs-navwrap .hs-nav a:nth-of-type(4){animation-delay:.12s !important}
  .hs-navwrap .hs-nav a:nth-of-type(5){animation-delay:.16s !important}
}
@keyframes hsBurgerIn{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}
@keyframes hsMenuIn{from{opacity:0;transform:translateY(-8px) rotate(-1.5deg)}to{opacity:1;transform:none}}
@keyframes hsMenuItem{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){
  .hs-burger,.hs-burger-art g,.hs-navwrap .hs-nav,.hs-navwrap .hs-nav a{animation:none !important;transition:none !important}
}

/* Creative Direction + Data Analytics: refinements to the stacked layout */
@media (max-width:1099px){
  /* Everything centred */
  .cc-sec{align-items:center !important}
  .cc-sec > *{align-self:center}
  .cc-title,.cc-center,.cc-tag{text-align:center !important}
  .cc-tag{white-space:normal !important;height:auto !important;font-size:15px !important;line-height:1.5 !important;text-wrap:balance}

  /* Body text: justified ("legal") with hyphenation so lines don't open big gaps */
  .cc-copy{align-self:stretch !important;width:auto !important;height:auto !important}
  .cc-copy,.cc-copy p,.cc-copy div{text-align:justify !important;text-align-last:left}
  .cc-copy p{width:auto !important;height:auto !important;text-align:justify !important;text-align-last:left;
    -webkit-hyphens:auto;hyphens:auto;overflow-wrap:break-word}

  /* Section order: page heading, section title, the visual, See More, then the body text */
  .cc-sec > h2.cc-center:not(.cc-title){order:-2}
  .cc-title{order:1}
  .cc-media,.da-card{order:2}
  .da-card ~ .da-card{order:5}          /* a section's second chart comes after its text */
  .cc-copy{order:3}
  .cc-more{order:4}
  .cc-touch{order:5}
  .cc-tag{order:2}                      /* tagline sits right under the first section's visual */
  .da-note{order:6}

  /* Page heading (Creative Direction / Data Analytics): same space below it as above it (48px) */
  .cc-sec.cc-in > h2.cc-center:not(.cc-title){margin-bottom:32px !important}  /* + the section's 16px gap */

  /* Section titles (Demo Reel, Longform, ...) about 15% smaller than desktop */
  .cc-title{font-size:17px !important;line-height:23px !important;letter-spacing:3.4px !important}

  /* Section titles sit between two hand-drawn lines that run out to the edges of the visual below */
  .cc-title{
    display:flex !important;align-items:center;justify-content:center;gap:14px;
    align-self:stretch !important;width:auto !important;max-width:none !important;white-space:nowrap
  }
  .cc-title::before,.cc-title::after{
    content:"";flex:1 1 0;min-width:18px;height:8px;
    background:url(../assets/ui/rule-left.svg) center / 100% 8px no-repeat
  }
  .cc-title::after{background-image:url(../assets/ui/rule-right.svg);margin-left:-3.4px} /* offsets the letter-spacing after the last letter */
  .cc-sec:has(> .cc-tall) > .cc-title{align-self:center !important;width:min(329px,100%) !important}  /* tall videos */
  .cc-about > .cc-title{align-self:center !important;width:min(272px,100%) !important}               /* contact card below */


  /* About / Get in touch keeps its own order */
  .cc-about > *{order:7}
  .cc-about > h2:not(.cc-title){order:-2}
  /* About portrait: the desktop composition (shaded panel behind, three dots, hand-drawn frame),
     at its desktop size (285 x 324), centred; the text flows underneath */
  .cc-about .da-about-grp{
    display:block !important;position:relative !important;left:auto !important;top:auto !important;
    order:2;align-self:stretch !important;width:auto !important;max-width:none !important;height:auto !important;
    padding-top:356px !important
  }
  .cc-about .da-about-grp > .cc-deco,
  .cc-about .da-about-grp > .cc-media{display:block !important;position:absolute !important;margin:0 0 0 calc(50% - 142.5px) !important}
  .cc-about .da-about-grp > img:nth-of-type(1){left:16px !important;top:14px !important;width:252px !important;height:310px !important}
  .cc-about .da-about-grp > img:nth-of-type(2){left:0 !important;top:240px !important;width:12px !important;height:12px !important}
  .cc-about .da-about-grp > img:nth-of-type(3){left:0 !important;top:258px !important;width:12px !important;height:12px !important}
  .cc-about .da-about-grp > img:nth-of-type(4){left:0 !important;top:276px !important;width:12px !important;height:12px !important}
  .cc-about .da-about-grp > .cc-media{left:47px !important;top:3px !important;width:238px !important;height:289px !important}
  .cc-about .da-about-grp > .cc-media > .cc-fill{position:absolute !important;inset:0 !important;width:100% !important;height:100% !important}
  .cc-about .da-about-grp > .cc-copy{position:static !important;width:auto !important}
  .cc-about > h2{width:auto !important}
  .cc-media svg{overflow:visible}
  .da-pbar{margin-left:12px !important;margin-right:12px !important;max-width:calc(100% - 24px);box-sizing:border-box}
}
