/* =========================================================================
   Home — values measured from the Desktop 1440 / Tablet 768 / Mobile 390 frames.
   ========================================================================= */

/* --- Hero -------------------------------------------------------------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* The bottom padding keeps the hero's designed height (it used to end with a "Scroll for more" line). */
  padding: 73px var(--layout-margin) 128px;
  text-align: center;
  /* A soft brand-blue glow behind the headline gives the deep-black page depth without a hard shape. */
  background: radial-gradient(60% 55% at 50% 38%, rgb(0 38 255 / 0.22), transparent 70%);
}

.hero__title {
  max-width: 300px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--display-hero);
  line-height: var(--display-hero-lh);
}

.hero__text {
  max-width: 350px;
  margin-top: 10.5px;
  color: var(--text-supporting);
  font-size: var(--text-body-m);
  line-height: var(--text-body-m-lh);
}

.hero__actions { justify-content: center; margin-top: 32.5px; }

@media (min-width: 768px) {
  .hero { padding-top: 100.5px; padding-bottom: 172px; }
  .hero__title { max-width: 590px; }
  .hero__text { max-width: 660px; margin-top: 11.5px; }
  .hero__actions { margin-top: 32px; }
}

@media (min-width: 1200px) {
  .hero { padding-top: 126px; padding-bottom: 250px; }
  .hero__title { max-width: 660px; }
  .hero__text { max-width: 600px; margin-top: 12px; }
}

/* Text Highlight — mimics a text selection: a box per line plus start/end handles.
   Handles are a fixed 56px bar with a 16px dot, top-aligned to their line at every breakpoint,
   positioned absolutely so they never change how the heading wraps. */
.text-highlight {
  --handle-bar: 56px;
  --content-area: 1.15em; /* Clash Display's rendered content box */
  margin-left: 4px;
  padding: calc((var(--display-hero-lh) - var(--content-area)) / 2) 3px;
  padding-left: 1px;
  background: #2C4E77;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.text-highlight__edge { position: relative; white-space: nowrap; }

.text-highlight__caret {
  position: absolute;
  top: calc((var(--content-area) - var(--display-hero-lh)) / 2);
  width: 3px;
  height: var(--handle-bar);
  background: var(--blue-550);
}

.text-highlight__caret--start { left: -4px; }
.text-highlight__caret--end { right: -6px; }

.text-highlight__caret::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue-550);
  transform: translateX(-50%);
}

.text-highlight__caret--start::after { top: -12px; }
.text-highlight__caret--end::after { bottom: -12px; }

/* Live selection (hero.js), like dragging a selection on a phone: the phrase starts as plain text, the start
   handle fades in, the blue selection sweeps smoothly across the words (one continuous speed, spread over the
   words by their width), then the end handle fades in. While it runs each word carries its own box with the same
   padding as the whole highlight (the first/last words absorb its outer 1px/3px padding with zero-sum negative
   margins); at the end the classes are removed so the original single highlight is back, pixel for pixel. */
@media (prefers-reduced-motion: no-preference) {
  .text-highlight.is-selecting { background: transparent; }
  .text-highlight.is-selecting .text-highlight__word {
    padding: calc((var(--display-hero-lh) - var(--content-area)) / 2) 0;
    background: linear-gradient(#2C4E77, #2C4E77) no-repeat 0 0 / 0% 100%;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }
  .text-highlight.is-selecting .text-highlight__edge > .text-highlight__word { margin-left: -1px; padding-left: 1px; }
  .text-highlight.is-selecting > .text-highlight__word:last-child { margin-right: -3px; padding-right: 3px; }
  .text-highlight.is-selecting .text-highlight__word.is-selected {
    animation: selection-sweep var(--sweep-ms) var(--sweep-ease, linear) var(--sweep-delay) both;
  }

  .text-highlight.is-selecting .text-highlight__caret { opacity: 0; transition: opacity 220ms ease-out; }
  .text-highlight.is-selecting .text-highlight__caret.is-shown { opacity: 1; }
}

@keyframes selection-sweep {
  from { background-size: 0% 100%; }
  to { background-size: 100% 100%; }
}
/* --- Intro (brief §10) ------------------------------------------------- */
.intro { display: none; }

.intro-active .intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: var(--layout-margin);
  background: var(--ink-900);
  transition: opacity 350ms var(--ease-standard), visibility 0s linear 350ms;
  /* Failsafe: if intro.js never runs, the overlay removes itself. */
  animation: intro-failsafe 0s linear 5s forwards;
}

.intro.is-leaving { opacity: 0; visibility: hidden; }

@keyframes intro-failsafe { to { opacity: 0; visibility: hidden; } }

.intro__stage {
  display: grid;
  gap: 24px;
  width: min(100%, 720px);
}

.intro__search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border: 1px solid var(--blue-600);
  border-radius: var(--radius-sm);
  background: var(--ink-900);
  color: var(--white);
  font-size: var(--text-body-l);
  line-height: var(--text-body-l-lh);
  transition: box-shadow 250ms var(--ease-standard);
}

.intro__search.is-submitted { box-shadow: 0 0 0 3px rgb(0 38 255 / 0.35); }

.intro__query { display: inline-flex; align-items: center; min-height: var(--text-body-l-lh); }

.intro__cursor {
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  background: var(--white);
  animation: intro-blink 1s steps(1) infinite;
}

@keyframes intro-blink { 50% { opacity: 0; } }

.intro__search .icon { flex: none; color: var(--grey-400); }

.intro__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

.intro__filter-icon { color: var(--grey-400); }

.intro__word {
  color: var(--grey-150);
  opacity: 0.45;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  transition: color 300ms var(--ease-standard), opacity 300ms var(--ease-standard);
}

.intro__word.is-active { color: var(--white); opacity: 1; }

.intro__skip {
  position: absolute;
  right: var(--layout-margin);
  bottom: var(--layout-margin);
  padding: 10px 16px;
  border: 1px solid var(--blue-950);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--grey-400);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  cursor: pointer;
}

.intro__skip:hover { color: var(--white); border-color: var(--blue-600); }

/* --- Experience -------------------------------------------------------- */
.experience { position: relative; }

.experience__head {
  display: flex;
  align-items: flex-start;
  height: 80px;
  padding: 26px var(--layout-margin) 0;
  border-bottom: 1px solid var(--grey-200);
}

.experience__title {
  color: var(--ink-950);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--display-section);
  line-height: var(--display-section-lh);
}

.experience__body { display: flex; flex-direction: column-reverse; }

.experience__about { padding: 32px var(--layout-margin) 48px; }

.experience__actions { margin-top: 28px; flex-direction: column; gap: 12px; }
.experience__actions .button { width: 100%; }

.experience__tools {
  position: relative;
  height: 240px;
  margin: 0;
  border-bottom: 1px solid var(--grey-200);
  /* From tablet up this layer covers the whole row, text and buttons included: let clicks pass through it, and
     keep only the tiles themselves interactive. */
  pointer-events: none;
}
.tool-tile { pointer-events: auto; }

.tool-tile {
  position: absolute;
  top: var(--tile-top);
  left: calc(50% + var(--tile-x-from-centre));
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 4px 8px rgb(2 19 113 / 0.48);
}

.tool-tile__logo { width: 28px; height: 28px; object-fit: contain; }
.tool-tile--jira .tool-tile__logo { width: 25px; height: 25px; }

/* Tile placement per breakpoint (top-left corner of each 48×48 tile). */
.tool-tile--usertesting { --tile-top: 15px; --tile-x-from-centre: -140.5px; }
.tool-tile--claude      { --tile-top: 25px; --tile-x-from-centre: 79px; }
.tool-tile--figma       { --tile-top: 75px; --tile-x-from-centre: -33.5px; }
.tool-tile--notion      { --tile-top: 85px; --tile-x-from-centre: 71.5px; }
.tool-tile--chatgpt     { --tile-top: 134px; --tile-x-from-centre: -94px; }
.tool-tile--webflow     { --tile-top: 134px; --tile-x-from-centre: -29px; }
.tool-tile--framer      { --tile-top: 179px; --tile-x-from-centre: -127.5px; }
.tool-tile--jira        { --tile-top: 179px; --tile-x-from-centre: 91.5px; }

.experience__foot { display: none; }

@media (min-width: 768px) {
  .experience__head { height: 96px; padding-top: 32px; }
  .experience__body {
    position: relative;
    flex-direction: row;
    min-height: 360px;
    border-bottom: 1px solid var(--grey-200);
  }
  .experience__about {
    align-self: flex-end;
    width: calc(412px + var(--layout-margin));
    padding: 0 0 23px var(--layout-margin);
  }
  .experience__actions { flex-direction: row; flex-wrap: nowrap; gap: 20px; margin-top: 28px; }
  .experience__actions .button { width: auto; }
  .experience__tools { position: absolute; inset: 0; height: auto; border: 0; }
  .tool-tile { left: auto; right: var(--tile-right); }
  .tool-tile--usertesting { --tile-top: 23px;  --tile-right: 216px; }
  .tool-tile--claude      { --tile-top: 39px;  --tile-right: 60px; }
  .tool-tile--figma       { --tile-top: 113px; --tile-right: 140px; }
  .tool-tile--notion      { --tile-top: 127.5px; --tile-right: 65.5px; }
  .tool-tile--chatgpt     { --tile-top: 202px; --tile-right: 182px; }
  .tool-tile--webflow     { --tile-top: 202px; --tile-right: 137px; }
  .tool-tile--framer      { --tile-top: 285px; --tile-right: 206px; }
  .tool-tile--jira        { --tile-top: 271px; --tile-right: 52px; }
  .experience__foot { display: block; height: 64px; }

  /* The same grid as desktop: two full-height hairlines frame the tool column; head/foot rows span the width.
     On tablet the left line sits just past the text column (experience.js keeps the tiles between the lines). */
  .experience::before,
  .experience::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--blue-800);
    pointer-events: none;
  }
  .experience::before { left: calc(412px + var(--layout-margin) + 16px); }
  .experience::after { right: calc(var(--layout-margin) - 1px); }
  .experience__head,
  .experience__body { border-bottom-color: var(--blue-800); }
}

@media (min-width: 1200px) {
  .experience::before { left: auto; right: 487px; }
  .experience::after { right: 71px; }
  .experience__head {
    height: 108px;
    padding: 60px 0 0 61px;
  }
  .experience__body { min-height: 452px; }
  .experience__about {
    width: auto;
    flex: 1;
    /* Stop 40px short of the tool column's line, so the text never runs over it on narrower desktops. */
    padding-right: 527px;
    padding-left: var(--layout-margin);
  }
  .experience__about .section-header__text { max-width: 720px; }
  .works__header .section-header__text { max-width: 620px; }
  .experience__tools { inset: 0 72px 0 auto; width: 415px; }
  .tool-tile { right: auto; left: var(--tile-left); }
  .tool-tile--usertesting { --tile-top: 29px;  --tile-left: 40px; }
  .tool-tile--claude      { --tile-top: 49px;  --tile-left: 301px; }
  .tool-tile--figma       { --tile-top: 144px; --tile-left: 167.5px; }
  .tool-tile--notion      { --tile-top: 160px; --tile-left: 292px; }
  .tool-tile--chatgpt     { --tile-top: 254px; --tile-left: 96px; }
  .tool-tile--webflow     { --tile-top: 254px; --tile-left: 172.5px; }
  .tool-tile--jira        { --tile-top: 340px; --tile-left: 316px; }
  .tool-tile--framer      { --tile-top: 358px; --tile-left: 56px; }
  .experience__foot { height: 120px; }
}

/* Experience tiles with real physics (experience.js + Matter.js): they drop from the section's top line, land and
   pile up on the bottom line, jump when tapped, and can be dragged and thrown. Without JS, with reduced motion, or
   before the engine has loaded, they simply sit in their designed positions above. */
.experience.is-armed .tool-tile { opacity: 0; }
.experience.is-physics .tool-tile {
  top: 0;
  right: auto;
  left: 0;
  touch-action: none; /* a touch on a tile grabs it; touching anywhere else still scrolls the page */
  user-select: none;
  cursor: grab;
  will-change: translate, rotate;
  /* Tactile feedback on top of the physics (JS drives translate/rotate; these only touch scale and shadow). */
  transition: scale 220ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 220ms ease;
}
@media (hover: hover) {
  .experience.is-physics .tool-tile:hover { scale: 1.06; box-shadow: 0 8px 16px rgb(2 19 113 / 0.4); }
}
.experience.is-physics .tool-tile.is-pressed { scale: 0.92; transition-duration: 90ms; }
.experience.is-physics .tool-tile.is-dragging {
  z-index: 2;
  scale: 1.1;
  cursor: grabbing;
  box-shadow: 0 16px 28px rgb(2 19 113 / 0.32);
}
.experience.is-physics .tool-tile.is-squash { scale: 1.08 0.9; transition-duration: 60ms; } /* landing thud */
.tool-tile__logo { pointer-events: none; -webkit-user-drag: none; }

/* --- Works ------------------------------------------------------------- */
.works { padding-top: 60px; }
.works__header { gap: 16px; padding: 0 var(--layout-margin); }

.folder-stack--desktop { display: none; }

.folder-stack--compact {
  margin: 24px 0 0;
  padding: 0;
}

.folder-card { position: relative; margin-top: -66px; } /* tab height 46 + the 20px body radius tucked under */
.folder-card:first-child { margin-top: 0; }

.folder-card__link {
  display: block;
  transition: transform 450ms var(--ease-standard);
}

.folder-card__tab {
  position: relative;
  display: block;
  width: 224px;
  height: 46px;
  margin-left: var(--tab-left-mobile);
  color: var(--folder-colour);
}

.folder-card__tab-shape { position: absolute; inset: 0; width: 100%; height: 100%; fill: currentColor; }
.folder-card__tab-shape--tablet { display: none; }

.folder-card__label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 1px;
  color: var(--label-colour);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--display-tab);
  line-height: var(--display-tab-lh);
  white-space: nowrap;
}

.folder-card__body {
  display: block;
  height: 126px;
  overflow: hidden;
  padding: 16px 0 0 16px;
  border-radius: 20px 20px 0 0;
  background: var(--folder-colour);
}

.folder-card:last-child .folder-card__body { height: 104px; }

.folder-card__headline {
  display: block;
  color: var(--headline-colour);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--display-xl);
  line-height: var(--display-xl-lh);
  white-space: nowrap;
}

@media (hover: hover) {
  .folder-card__link:hover { transform: translateY(-4px); }
}

@media (min-width: 768px) {
  .folder-stack--compact { margin-top: 32px; }
  .folder-card__tab { width: 440px; margin-left: var(--tab-left-tablet); }
  .folder-card__tab-shape--tablet { display: block; }
  .folder-card__label { padding-top: 5px; }
  .folder-card__tab-shape--mobile { display: none; }
  .folder-card__body { height: 170px; padding-top: 16px; }
  .folder-card:last-child .folder-card__body { height: 174px; }
}

@media (min-width: 1200px) {
  .folder-stack--compact { display: none; }
  .folder-stack--desktop { display: block; margin-top: 40px; }
}

.folder-stack__canvas {
  width: 100%;
  height: auto;
  overflow: hidden;
}

/* The 4px hover lift is animated by works.js through the SVG transform attribute: CSS transforms on SVG
   children make browsers (Safari especially) rasterise and smear the shapes while they move. */
.folder { outline: none; }

.folder:focus-visible .folder__shape { stroke: var(--blue-300); stroke-width: 3; }

.folder__label,
.folder__headline {
  font-family: var(--font-display);
  font-weight: 600;
}

.folder__label { font-size: 28px; }
.folder__headline { font-size: 124px; }

/* --- Contact spacing on Home ------------------------------------------- */
.page--home .contact { padding-top: 72px; padding-bottom: 72px; }

@media (min-width: 768px) {
  .page--home .contact { padding-top: 100px; padding-bottom: 100px; }
}

@media (min-width: 1200px) {
  .page--home .contact { padding-top: 113px; padding-bottom: 180px; }
}
