/* MrJoeJackson Site Enhancements
   Only the pieces Elementor cannot do natively. Colours and type stay in Elementor's Site Settings. */

/* 1. Hero portrait: the canvas the script adds over the photograph */
.jj-hero-media { overflow: hidden; }
.jj-hero-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

/* 2. Doors and signature. Two angled panels that close over the page; the signature is written
      across them, left to right, while the page loads. Invisible unless <html> carries
      .jj-doors-closed (set by the head script) or .jj-closing (set when leaving a page).
      Clicks always pass through, and a CSS-only timer opens the doors if the script never does. */
.jj-doors { position: fixed; inset: 0; z-index: 2147483646; pointer-events: none; visibility: hidden; transition: visibility 0s linear 540ms; }
.jj-door { position: absolute; inset: 0; transition: transform 500ms cubic-bezier(0.7, 0, 0.2, 1); will-change: transform; }
.jj-door-l { background: #0C0F15; clip-path: polygon(0 0, 57% 0, 43% 100%, 0 100%); transform: translate3d(-58%, 0, 0); }
.jj-door-r { background: #11151D; clip-path: polygon(57% 0, 100% 0, 100% 100%, 43% 100%); transform: translate3d(58%, 0, 0); }
.jj-sign { position: absolute; top: 50%; left: 50%; width: min(78vw, 760px); height: auto; aspect-ratio: 1400 / 435; max-height: 60vh; transform: translate(-50%, -50%); opacity: 0; transition: opacity 240ms ease; }
.jj-doors-closed .jj-doors, .jj-closing .jj-doors { visibility: visible; transition-delay: 0s; }
.jj-doors-closed .jj-door, .jj-closing .jj-door { transform: translate3d(0, 0, 0); }
.jj-doors-closed .jj-sign.jj-sign-on { opacity: 1; }
.jj-doors-closed .jj-doors { animation: jj-doors-failsafe 500ms ease 8s forwards; }
@keyframes jj-doors-failsafe { to { opacity: 0; visibility: hidden; } }
/* The accessibility button already sits at the highest possible layer, so it is faded out while the doors are shut. */
#ea11y-root { transition: opacity 300ms ease; }
.jj-doors-closed #ea11y-root, .jj-closing #ea11y-root { opacity: 0; pointer-events: none; }
.jj-doors-closed #ea11y-root { animation: jj-a11y-failsafe 300ms ease 8s forwards; }
@keyframes jj-a11y-failsafe { to { opacity: 1; pointer-events: auto; } }

/* 3. Project tile: logo at rest, a tall page capture that scrolls once on hover or keyboard focus.
      The script adds these classes to any link holding an "mrjj-tall-" image, and sets --jj-dur from its proportions. */
.jj-preview { position: relative; overflow: hidden; container-type: inline-size; }
.jj-preview .jj-preview-logo { transition: opacity 320ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.jj-preview img.jj-preview-shot { position: absolute; top: 0; left: 0; width: 100%; max-width: none; height: auto; opacity: 0; transform: translateY(0); transition: opacity 320ms cubic-bezier(0.2, 0.7, 0.2, 1), transform 0s linear 340ms; }
@media (hover: hover) {
  .jj-preview:hover .jj-preview-logo, .jj-preview:focus-visible .jj-preview-logo { opacity: 0; }
  .jj-preview:hover img.jj-preview-shot, .jj-preview:focus-visible img.jj-preview-shot { opacity: 1; transform: translateY(calc(-100% + 100cqw)); transition: opacity 320ms cubic-bezier(0.2, 0.7, 0.2, 1), transform var(--jj-dur, 6s) linear 360ms; }
}
@media (hover: none) { .jj-preview img.jj-preview-shot { display: none; } }

/* 4. Contact form spam trap: off-screen, never focusable */
.jj-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* 6. Wordmark: hovering the MRJOEJACKSON link home gives it the hero's glitch. Two copies of the word
      (brand blue and blue-white) slip sideways in thin slices for a moment, then the word rests in blue.
      The script adds .jj-logo and data-text to the link. */
a.jj-logo { position: relative !important; display: inline-block !important; white-space: nowrap; transition: color 160ms ease; }
.jj-logo::before, .jj-logo::after { content: attr(data-text); position: absolute; left: 0; top: 0; width: 100%; opacity: 0; pointer-events: none; }
.jj-logo::before { color: #7AA7F7; }
.jj-logo::after { color: #DEE8FC; }
@media (hover: hover) {
  .jj-logo:hover { color: #9CBEFA; }
  .jj-logo:hover::before { animation: jj-logo-a 2.6s steps(1, end) infinite; }
  .jj-logo:hover::after { animation: jj-logo-b 2.6s steps(1, end) infinite; }
}
.jj-logo:focus-visible { color: #9CBEFA; }
@keyframes jj-logo-a {
  0% { opacity: 1; transform: translateX(-7px); clip-path: inset(8% 0 62% 0); }
  3% { opacity: 1; transform: translateX(9px); clip-path: inset(55% 0 18% 0); }
  6% { opacity: 1; transform: translateX(-4px); clip-path: inset(30% 0 44% 0); }
  9% { opacity: 1; transform: translateX(12px); clip-path: inset(70% 0 6% 0); }
  12% { opacity: 1; transform: translateX(-10px); clip-path: inset(0 0 80% 0); }
  15% { opacity: 0; }
  62% { opacity: 1; transform: translateX(6px); clip-path: inset(40% 0 38% 0); }
  64% { opacity: 0; }
  100% { opacity: 0; }
}
@keyframes jj-logo-b {
  0% { opacity: 1; transform: translateX(8px); clip-path: inset(48% 0 30% 0); }
  3% { opacity: 1; transform: translateX(-11px); clip-path: inset(12% 0 70% 0); }
  6% { opacity: 1; transform: translateX(5px); clip-path: inset(76% 0 4% 0); }
  9% { opacity: 1; transform: translateX(-6px); clip-path: inset(22% 0 58% 0); }
  12% { opacity: 1; transform: translateX(10px); clip-path: inset(60% 0 22% 0); }
  15% { opacity: 0; }
  62% { opacity: 1; transform: translateX(-8px); clip-path: inset(64% 0 16% 0); }
  64% { opacity: 0; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .jj-doors { display: none; }
  .jj-logo:hover::before, .jj-logo:hover::after { animation: none; }
  .jj-preview .jj-preview-logo, .jj-preview img.jj-preview-shot { transition: none; }
  .jj-preview:hover img.jj-preview-shot, .jj-preview:focus-visible img.jj-preview-shot { transform: none; transition: none; }
}

/* 5. Ten-project tiles (built in Elementor). The scrolling capture is the "site-capture-" image inside the tile link.
      Touch screens keep the cover and logo; reduced motion shows the capture without scrolling it. */
@media (hover: none) {
  a > img[src*="site-capture-"], a > img[src*="site-capture-"] + div { display: none !important; }
  a > img:has(~ img[src*="site-capture-"]), a > div:has(~ img[src*="site-capture-"]) { opacity: 1 !important; }
}
@media (prefers-reduced-motion: reduce) {
  a > img[src*="site-capture-"] { transform: none !important; transition: none !important; }
}

/* 7. About page refinements. Elements are marked in Elementor (Attributes): logo cells carry data-jj-logo, the agency
      list data-jj-previews, linked agency rows data-jj-preview-row with a hidden data-jj-preview-image screenshot.
      Hover and focus styles for the logos live in Elementor; these rules cover what Elementor cannot. */
/* The hidden name labels are wider than their cells; keep them from widening the page on narrow non-touch windows. */
section:has([data-jj-logo]) { overflow-x: clip; }
[data-jj-logo][data-jj-off] > p, [data-jj-logo][data-jj-off] > div { opacity: 0 !important; }
[data-jj-logo][data-jj-off] > img { opacity: 0.8 !important; }
@media (hover: none) {
  /* Touch: no hover, so every logo shows its name as a caption and keeps the single-colour mark. */
  [data-jj-logo] { display: grid !important; grid-template-rows: 58px auto; row-gap: 8px; justify-items: center; align-items: center; height: auto !important; }
  [data-jj-logo] > img { max-height: 58px; object-fit: contain; opacity: 0.85 !important; }
  [data-jj-logo] > div { display: none !important; }
  [data-jj-logo] > p { position: static !important; transform: none !important; align-self: start; width: auto !important; max-width: 100% !important; padding: 0 !important; border: 0 !important;
    background: none !important; color: #A9AFBC !important; font-size: 11px !important; opacity: 1 !important; }
}
/* Agency list thumbnail (0.5.5): a 400x250 window that follows the cursor; the script sets its position. */
.jj-agency-preview { position: fixed; z-index: 900; top: 0; left: 0; width: 400px; height: 250px; max-width: 70vw; pointer-events: none; will-change: transform; }
.jj-agency-box { width: 100%; height: 100%; overflow: hidden; transform: scale(0); transform-origin: center center; transition: transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.jj-agency-preview.is-on .jj-agency-box { transform: scale(1); transition-duration: 400ms; }
.jj-agency-strip { display: flex; flex-direction: column; width: 100%; height: 100%; transition: transform 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.jj-agency-thumb { flex: 0 0 100%; width: 100%; height: 100%; background: #181D27; }
.jj-agency-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
@media (hover: none) { .jj-agency-preview { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .jj-agency-box, .jj-agency-strip { transition: none !important; } }
@media (prefers-reduced-motion: reduce) { [data-jj-logo] > *, [data-jj-preview-row] a > * { transition: none !important; } }

/* 8. Disclosures (0.5.6). In Elementor a button carries data-jj-disclosure and aria-controls="<panel id>"; the panel
      carries data-jj-panel and holds one child. Without the script every panel simply stays open. */
[data-jj-disclosure] { cursor: pointer; -webkit-appearance: none; appearance: none; }
[data-jj-disclosure] > :last-child { transition: transform 220ms ease; }
[data-jj-disclosure][aria-expanded="true"] > :last-child { transform: rotate(45deg); }
[data-jj-panel].jj-panel { display: grid !important; grid-template-rows: 1fr; opacity: 1; visibility: visible;
  transition: grid-template-rows 280ms ease, opacity 220ms ease, visibility 0s linear 0s; }
[data-jj-panel].jj-panel > * { min-height: 0; overflow: hidden; transition: padding 280ms ease; }
[data-jj-panel].jj-panel.is-closed > * { padding-top: 0 !important; padding-bottom: 0 !important; }
[data-jj-panel].jj-panel.is-closed { grid-template-rows: 0fr; opacity: 0; visibility: hidden;
  transition: grid-template-rows 280ms ease, opacity 180ms ease, visibility 0s linear 280ms; }
@media (prefers-reduced-motion: reduce) { [data-jj-panel].jj-panel, [data-jj-panel].jj-panel.is-closed, [data-jj-panel].jj-panel > *, [data-jj-disclosure] > :last-child { transition: none !important; } }

/* 9. Showcase photo backdrops (0.6.1). In Elementor the wrapper around a showcase carries data-jj-visual and holds an
      Image marked data-jj-photo="right" or "left": the side of the page the photograph is strongest on. The image is
      darkened, runs past the component to the page edge, and fades out toward the copy and at the top and bottom.
      The width sum is the component plus the page gutter (the 1240px content column and its side padding). */
.elementor:has([data-jj-photo]) { overflow-x: clip; }
[data-jj-visual] { position: relative; isolation: isolate; }
[data-jj-visual] [data-jj-photo] { position: absolute !important; z-index: -1; top: -110px; left: -14%; width: calc(114% + max((100vw - 1240px) / 2, 0px) + clamp(20px, 5vw, 64px)) !important; max-width: none !important; height: calc(100% + 220px) !important;
  object-fit: cover; pointer-events: none; -webkit-user-select: none; user-select: none; opacity: 0.9; filter: brightness(0.62) saturate(0.95);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 48%), linear-gradient(to bottom, transparent 0, #000 30%, #000 70%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 48%), linear-gradient(to bottom, transparent 0, #000 30%, #000 70%, transparent 100%);
  -webkit-mask-composite: source-in; mask-composite: intersect; }
[data-jj-visual] [data-jj-photo="left"] { left: auto; right: -14%;
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 48%), linear-gradient(to bottom, transparent 0, #000 30%, #000 70%, transparent 100%);
  mask-image: linear-gradient(to left, transparent 0, #000 48%), linear-gradient(to bottom, transparent 0, #000 30%, #000 70%, transparent 100%); }
@media (max-width: 1024px) {
  /* Stacked layout: the photograph sits behind the component only, edge to edge, and the copy keeps a plain background. */
  [data-jj-visual] [data-jj-photo], [data-jj-visual] [data-jj-photo="left"] { top: -56px; left: calc(50% - 50vw); right: auto; width: 100vw !important; height: calc(100% + 112px) !important;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 78%, transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 78%, transparent 100%); }
}

/* 10. Project slides (0.6.2). The container marked data-jj-slides becomes a floating frame; its value picks the accent
       (deer, tps, jlv). The slides themselves, their headings, images and captions, are ordinary Elementor elements. */
[data-jj-slides] { --jj-a: #7AA7F7; padding: 0 !important; background: rgba(17, 21, 29, 0.93); border: 1px solid rgba(244, 240, 232, 0.16) !important; border-radius: 16px !important; overflow: hidden;
  box-shadow: 0 36px 72px -26px rgba(0, 0, 0, 0.82), 0 10px 24px -10px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
[data-jj-slides="deer"] { --jj-a: #E8B64C; }
[data-jj-slides="tps"] { --jj-a: #F08FB5; }
[data-jj-slides="jlv"] { --jj-a: #FFD23F; background: rgba(19, 16, 31, 0.93); }
.jj-slides { display: grid !important; grid-template-columns: minmax(0, 1fr); }
.jj-slides > .jj-slide { grid-area: 1 / 1; visibility: hidden; opacity: 0; transition: opacity 280ms ease, visibility 0s linear 280ms; }
.jj-slides > .jj-slide.is-on { visibility: visible; opacity: 1; transition: opacity 280ms ease; }
.jj-slides-bar { grid-row: 2; position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 18px 16px; }
.jj-slides-mid { display: flex; align-items: center; gap: 12px; }
.jj-slides-dots { display: flex; align-items: center; }
.jj-slides-count { color: #A9AFBC; font: 500 13px/1 "DM Sans", system-ui, sans-serif; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.jj-slides-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.jj-slides-bar button, .jj-slides-bar button:hover, .jj-slides-bar button:focus { margin: 0; padding: 0; background-color: transparent; color: #F4F0E8; border: 0; border-radius: 50%; font: 500 18px/1 "DM Sans", system-ui, sans-serif; cursor: pointer; }
.jj-slides-bar .jj-slides-arrow, .jj-slides-bar .jj-slides-arrow:hover, .jj-slides-bar .jj-slides-arrow:focus { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid rgba(244, 240, 232, 0.22); transition: border-color 140ms ease, background-color 140ms ease; }
.jj-slides-bar .jj-slides-arrow:hover { border-color: var(--jj-a); background-color: rgba(244, 240, 232, 0.06); }
.jj-slides-bar .jj-slides-dot, .jj-slides-bar .jj-slides-dot:hover, .jj-slides-bar .jj-slides-dot:focus { display: grid; place-items: center; width: 28px; height: 44px; border-radius: 0; }
.jj-slides-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: rgba(244, 240, 232, 0.28); transition: background-color 140ms ease, transform 140ms ease; }
.jj-slides-dot:hover::before { background: rgba(244, 240, 232, 0.6); }
.jj-slides-dot[aria-current]::before { background: var(--jj-a); transform: scale(1.25); }
.jj-slides-bar button:focus-visible { outline: 2px solid var(--jj-a); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .jj-slides > .jj-slide, .jj-slides > .jj-slide.is-on, .jj-slides-bar button, .jj-slides-dot::before { transition: none; } }

/* 11. Project tile contributions (0.6.3). Classes come from Elementor global classes on the shared "Project tiles"
       component: jj-tile, jj-tile-toggle, jj-tile-panel, jj-tile-panel-title, jj-tile-item.
       Mouse and trackpad: the list appears over the image while it is hovered or focused, and the button is not shown.
       Touch: the button opens the list below the project line; the image link behaves as a plain link. */
.jj-tile { position: relative; }
.jj-tile > .jj-tile-toggle > :last-child { display: inline-block; font-weight: 400; font-size: 18px; line-height: 1; }
.jj-tile .jj-tile-item { position: relative; padding-left: 13px; }
.jj-tile .jj-tile-item::before { content: ""; position: absolute; left: 0; top: 0.58em; width: 5px; height: 5px; border-radius: 50%; background: #7AA7F7; }
@media (hover: none) {
  .jj-tile > .jj-tile-toggle { display: inline-flex !important; }
  .jj-tile .jj-tile-panel-title { display: none; }
  .jj-tile .jj-tile-item { color: #A9AFBC; }
}
@media (hover: hover) {
  .jj-tile > .jj-tile-toggle { display: none !important; }
  /* The panel sits exactly over the square image, dark enough to read over the moving capture. Pointer events pass
     through to the image link. A long list on a narrow tile may grow the box downward rather than clip. */
  .jj-tile > .jj-tile-panel, .jj-tile > .jj-tile-panel.jj-panel, .jj-tile > .jj-tile-panel.jj-panel.is-closed {
    position: absolute !important; z-index: 2; top: 0; left: 0; width: 100% !important; aspect-ratio: 1 / 1; height: auto;
    display: block !important; visibility: visible !important; opacity: 0; overflow: visible; pointer-events: none;
    padding: 14px !important; border-radius: 12px; background: rgba(8, 10, 15, 0.62); transition: opacity 300ms ease; }
  .jj-tile > .jj-tile-panel > * { overflow: visible !important; padding: 0 !important; }
  .jj-tile:has(> a:hover) > .jj-tile-panel, .jj-tile:has(> a:focus-visible) > .jj-tile-panel { opacity: 1 !important; }
  .jj-tile .jj-tile-panel-body { gap: 6px !important; }
  .jj-tile .jj-tile-list { gap: 3px !important; }
  .jj-tile .jj-tile-item { font-size: 13.5px !important; line-height: 1.3 !important; }
}
/* Narrow desktop tiles (small laptop windows): a little less padding so the longest lists stay inside the image. */
.jj-tile { container-type: inline-size; }
@media (hover: hover) {
  @container (max-width: 200px) {
    .jj-tile > .jj-tile-panel, .jj-tile > .jj-tile-panel.jj-panel, .jj-tile > .jj-tile-panel.jj-panel.is-closed { padding: 11px 12px !important; }
    .jj-tile .jj-tile-panel-body { gap: 4px !important; }
    .jj-tile .jj-tile-list { gap: 2px !important; }
    .jj-tile .jj-tile-item { font-size: 13px !important; }
  }
}
/* Long lists (0.6.4): six or more items use tighter leading and spacing so they stay inside the image. */
@media (hover: hover) {
  .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(6)) { padding: 12px 13px !important; }
  .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(6)) .jj-tile-panel-body { gap: 4px !important; }
  .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(5)) .jj-tile-list { gap: 1px !important; }
  .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(5)) .jj-tile-item { line-height: 1.22 !important; }
  .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(6)) .jj-tile-item { font-size: 13px !important; }
  @container (max-width: 200px) {
    .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(5)) { padding: 10px 11px !important; }
    .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(5)) .jj-tile-panel-body { gap: 3px !important; }
    .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(5)) .jj-tile-panel-title { font-size: 11px !important; }
    .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(6)) .jj-tile-item { font-size: 12.5px !important; line-height: 1.18 !important; }
    .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(6)) .jj-tile-item::before { width: 4px; height: 4px; }
   }
  /* Narrowest desktop windows (about 1025-1110px): the small "My contribution" heading steps aside for the longest lists. */
  @container (max-width: 185px) {
    .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(5)) .jj-tile-panel-title { display: none !important; }
  }
  @container (max-width: 175px) {
    .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(4)) { padding: 10px 11px !important; }
    .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(4)) .jj-tile-panel-title { display: none !important; }
    .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(4)) .jj-tile-list { gap: 1px !important; }
    .jj-tile > .jj-tile-panel:has(.jj-tile-item:nth-child(4)) .jj-tile-item { font-size: 12.5px !important; line-height: 1.18 !important; }
  }
}
@media (prefers-reduced-motion: reduce) { .jj-tile > .jj-tile-panel { transition: none !important; } }
