/* JERICH.IO Creative as a phone app: dock, tool panels, one slider at a time. */
#ja-dock, #ja-panel, #ja-empty, #ja-rt-stage, .ja-cmp { display: none; }
html.ja { --ja-ink: #1A1917; --ja-paper: #F3F0E9; --ja-panel: #FAF8F3; --ja-quiet: #6E685D; --ja-line: rgba(26, 25, 23, .13); --ja-blue: #2A4C9B; }

/* The old step tabs and sheet step aside; they come back under All tools. */
html.ja:not(.ja-adv) #jm-tabs, html.ja:not(.ja-adv) #jm-sheet { display: none !important; }
html.ja #jm-bar .ja-cmp { display: inline-flex; }
html.ja.ja-adv #jm-bar .ja-cmp { display: none; }
#jm-bar .ja-cmp.is-on { background: var(--ja-ink); color: var(--ja-paper); }

/* Dock */
html.ja:not(.ja-adv):not(.ja-open) #ja-dock {
  display: flex; position: fixed; z-index: 45; left: 0; right: 0; bottom: 0;
  height: calc(66px + env(safe-area-inset-bottom, 0px)); padding: 0 6px env(safe-area-inset-bottom, 0px); box-sizing: border-box;
  background: var(--ja-paper); border-top: 1px solid var(--ja-line);
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x proximity;
  font-family: 'Familjen Grotesk', 'Inter', sans-serif;
}
#ja-dock::-webkit-scrollbar { display: none; }
#ja-dock button { all: unset; box-sizing: border-box; flex: 0 0 auto; min-width: 66px; height: 66px; padding: 10px 4px 8px; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer;
  color: var(--ja-ink); font-size: 11px; font-weight: 500; letter-spacing: .01em; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
#ja-dock button svg { width: 23px; height: 23px; }
#ja-dock button:active { background: rgba(26, 25, 23, .06); }
#ja-dock button:focus-visible { outline: 2px solid var(--ja-blue); outline-offset: -3px; }
#ja-dock.is-empty button[data-tool="filters"], #ja-dock.is-empty button[data-tool="adjust"],
#ja-dock.is-empty button[data-tool="retouch"], #ja-dock.is-empty button[data-tool="cutout"] { color: rgba(26, 25, 23, .38); }
#ja-dock button[data-tool="layers"] { border-left: 1px solid var(--ja-line); margin-left: 4px; }

/* Tool panel */
html.ja.ja-open:not(.ja-adv) #ja-panel {
  display: flex; flex-direction: column; position: fixed; z-index: 46; left: 0; right: 0; bottom: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--ja-panel); border-top: 1px solid var(--ja-line);
  font-family: 'Familjen Grotesk', 'Inter', sans-serif; color: var(--ja-ink);
  animation: ja-up .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes ja-up { from { transform: translateY(18px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { html.ja.ja-open #ja-panel { animation: none; } }
.ja-body { height: auto; min-height: 154px; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 10px 0 8px; box-sizing: border-box; overflow: hidden; }
.ja-foot { flex: none; height: 50px; display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; border-top: 1px solid var(--ja-line); }
.ja-foot button { all: unset; box-sizing: border-box; width: 56px; height: 50px; display: grid; place-items: center; cursor: pointer; color: var(--ja-ink); }
.ja-foot button svg { width: 24px; height: 24px; }
.ja-foot .ja-ok svg { stroke-width: 2; }
.ja-foot button:focus-visible { outline: 2px solid var(--ja-blue); outline-offset: -3px; }
.ja-title { text-align: center; font-size: 11.5px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; }

/* Thumbnail strip */
.ja-strip { display: flex; align-items: flex-start; gap: 10px; padding: 2px 16px 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; flex: none; }
.ja-strip::-webkit-scrollbar { display: none; }
.ja-card { all: unset; box-sizing: border-box; flex: 0 0 auto; width: 70px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ja-card canvas { width: 70px; height: 70px; display: block; background: #E7E1D5; outline: 1px solid var(--ja-line); outline-offset: -1px; }
.ja-card span { font-size: 10.5px; line-height: 1.2; color: var(--ja-quiet); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ja-card.is-on canvas { outline: 2px solid var(--ja-ink); outline-offset: 2px; }
.ja-card.is-on span { color: var(--ja-ink); font-weight: 600; }
.ja-card:focus-visible canvas { outline: 2px solid var(--ja-blue); outline-offset: 2px; }
.ja-cat { flex: 0 0 auto; align-self: stretch; height: 70px; writing-mode: vertical-rl; transform: rotate(180deg); text-align: center;
  font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--ja-quiet); border-left: 1px solid var(--ja-line); padding-left: 4px; margin-left: 2px; white-space: nowrap; overflow: hidden; }

/* Two-way switch */
.ja-seg { flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 0 16px; border: 1px solid var(--ja-ink); }
.ja-seg button { all: unset; box-sizing: border-box; height: 32px; display: grid; place-items: center; cursor: pointer; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ja-ink); }
.ja-seg button + button { border-left: 1px solid var(--ja-ink); }
.ja-seg button[aria-selected="true"] { background: var(--ja-ink); color: var(--ja-paper); }
.ja-seg button:focus-visible { outline: 2px solid var(--ja-blue); outline-offset: -3px; }

/* Chips: the tools inside a tool */
.ja-chips, .ja-tools { flex: none; display: flex; gap: 2px; padding: 0 10px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.ja-chips::-webkit-scrollbar, .ja-tools::-webkit-scrollbar { display: none; }
.ja-chip { all: unset; box-sizing: border-box; flex: 0 0 auto; min-width: 64px; height: 58px; padding: 6px 6px 4px; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer;
  font-size: 10.5px; color: var(--ja-quiet); white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.ja-chip svg { width: 22px; height: 22px; }
.ja-chip.is-on { color: var(--ja-ink); font-weight: 600; }
.ja-chip.is-on::after { content: ''; position: absolute; left: 30%; right: 30%; bottom: 0; height: 2px; background: var(--ja-ink); }
.ja-chip.has-val::before { content: ''; position: absolute; top: 5px; right: 14px; width: 5px; height: 5px; background: var(--ja-blue); }
.ja-chip:focus-visible { outline: 2px solid var(--ja-blue); outline-offset: -3px; }
.ja-chips-tall .ja-chip { height: 72px; min-width: 76px; color: var(--ja-ink); }
.ja-chip.ja-mini { flex-direction: row; height: 32px; min-width: 0; padding: 0 12px; gap: 6px; border: 1px solid var(--ja-line); margin-right: 6px; color: var(--ja-ink); }
.ja-chip.ja-mini svg { width: 16px; height: 16px; }
.ja-chip.ja-mini.is-on { background: var(--ja-ink); color: var(--ja-paper); border-color: var(--ja-ink); }
.ja-chip.ja-mini.is-on::after { display: none; }
.ja-tools { padding: 0 16px; }

/* One slider */
.ja-ruler { flex: none; display: grid; grid-template-columns: 1fr auto auto; align-items: center; column-gap: 10px; padding: 0 16px; }
.ja-ruler[hidden] { display: none; }
.ja-rl { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ja-quiet); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ja-rv { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.ja-r0 { all: unset; cursor: pointer; font-size: 11px; color: var(--ja-blue); padding: 4px 0 4px 6px; }
.ja-r0:disabled { color: rgba(26, 25, 23, .3); cursor: default; }
.ja-ruler input[type=range] { grid-column: 1 / -1; -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 2px 0 0; background: transparent; touch-action: pan-y; }
/* The filled stretch is painted on the input itself: Safari doesn't repaint a track that reads
   custom properties, so the bar stayed grey there while the value moved. */
.ja-ruler input[type=range] { background: linear-gradient(to right, rgba(26,25,23,.18) 0 var(--a, 0%), var(--ja-ink) var(--a, 0%) var(--b, 0%), rgba(26,25,23,.18) var(--b, 0%) 100%) center / calc(100% - 20px) 2px no-repeat; }
.ja-ruler input[type=range]::-webkit-slider-runnable-track { height: 2px; background: transparent; }
.ja-ruler input[type=range]::-moz-range-track { height: 2px; background: transparent; }
.ja-ruler input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -9px; background: var(--ja-ink); border: 3px solid var(--ja-panel); box-shadow: 0 0 0 1px var(--ja-ink); }
.ja-ruler input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 0; background: var(--ja-ink); border: 3px solid var(--ja-panel); box-shadow: 0 0 0 1px var(--ja-ink); }
.ja-ruler input[type=range]:focus-visible { outline: 2px solid var(--ja-blue); outline-offset: 2px; }

/* Buttons and notes */
.ja-acts { flex: none; display: flex; gap: 8px; padding: 0 16px; }
.ja-primary, .ja-second { all: unset; box-sizing: border-box; flex: 1; height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  font-family: 'Familjen Grotesk', 'Inter', sans-serif; font-size: 14px; font-weight: 600; }
.ja-primary { background: var(--ja-ink); color: var(--ja-paper); }
.ja-second { border: 1px solid var(--ja-ink); color: var(--ja-ink); }
.ja-primary svg, .ja-second svg { width: 18px; height: 18px; }
.ja-primary:disabled { opacity: .45; }
.ja-primary[hidden], .ja-second[hidden] { display: none; }
.ja-primary:focus-visible, .ja-second:focus-visible { outline: 2px solid var(--ja-blue); outline-offset: 2px; }
.ja-note { margin: 0; padding: 0 16px; font-size: 12px; line-height: 1.4; color: var(--ja-quiet); }
.ja-swatches { flex: none; display: flex; gap: 10px; padding: 0 16px 4px; }
.ja-swatches[hidden] { display: none; }
.ja-sw { all: unset; box-sizing: border-box; width: 36px; height: 36px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(26, 25, 23, .25); }
.ja-sw-none { background: linear-gradient(to top right, transparent 47%, #C7391F 47% 53%, transparent 53%), #fff; }
.ja-sw:focus-visible { outline: 2px solid var(--ja-blue); outline-offset: 2px; }

/* First open: no photo yet */
html.ja:not(.ja-adv) #ja-empty.is-on {
  display: flex; flex-direction: column; align-items: stretch; gap: 10px; position: fixed; z-index: 44;
  left: 24px; right: 24px; top: 50%; transform: translateY(-60%); max-width: 360px; margin: 0 auto;
  padding: 24px 22px 18px; background: var(--ja-panel); border: 1px solid var(--ja-line); box-shadow: 0 24px 50px -30px rgba(26, 25, 23, .45);
  font-family: 'Familjen Grotesk', 'Inter', sans-serif; color: var(--ja-ink); text-align: left;
}
.ja-empty-h { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.ja-empty-p { margin: 0 0 8px; font-size: 14px; line-height: 1.45; color: var(--ja-quiet); }
#ja-empty .ja-primary { flex: none; height: 50px; }
.ja-link { all: unset; cursor: pointer; text-align: center; font-size: 13.5px; color: var(--ja-ink); text-decoration: underline; text-underline-offset: 3px; padding: 8px; }
.ja-link:focus-visible { outline: 2px solid var(--ja-blue); }

/* Retouch: the photo itself becomes the retouch view */
html.ja.ja-rt-on:not(.ja-adv) #ja-rt-stage {
  display: flex; flex-direction: column; position: fixed; z-index: 43; left: 0; right: 0;
  top: calc(var(--jm-bar, 52px) + env(safe-area-inset-top, 0px)); bottom: var(--jm-sheet, 0px);
  background: var(--ja-paper); font-family: 'Familjen Grotesk', 'Inter', sans-serif;
}
.ja-rt-read { margin: 0; padding: 8px 16px 0; min-height: 18px; font-size: 12px; color: var(--ja-quiet); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ja-rt-hold { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px 14px 14px; touch-action: none; }
html.ja #ja-rt-stage #rt-spot { width: auto !important; height: auto !important; max-width: 100% !important; max-height: 100% !important; border: 0 !important; box-shadow: 0 10px 30px -18px rgba(26, 25, 23, .5); }
.ja-rt-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; background: var(--ja-panel); border: 1px solid var(--ja-line); }
.ja-rt-zoom button { all: unset; width: 38px; height: 34px; display: grid; place-items: center; cursor: pointer; font-size: 15px; color: var(--ja-ink); }
.ja-rt-zoom button + button { border-left: 1px solid var(--ja-line); }
.ja-rt-zoom button:focus-visible { outline: 2px solid var(--ja-blue); outline-offset: -2px; }

/* Keep the layer action bar above the dock, and out of the way while a tool is open */
html.ja.ja-open:not(.ja-adv) #jm-act { display: none !important; }
.ja-tools[hidden], .ja-chips[hidden] { display: none; }
.ja-ruler .ja-rl { grid-row: 1; grid-column: 1; }
.ja-ruler .ja-rv { grid-row: 1; grid-column: 2; }
.ja-ruler .ja-r0 { grid-row: 1; grid-column: 3; }
.ja-ruler input[type=range] { grid-row: 2; }
#ja-dock button { min-width: 60px; }
#ja-panel[data-tool="retouch"] .ja-body { min-height: 196px; }
@media (max-height: 700px) { .ja-body { min-height: 140px; padding-top: 8px; } #ja-panel[data-tool="retouch"] .ja-body { min-height: 180px; } .ja-chip { height: 54px; } }
/* DPA Frames: product thumbnails in the strip, and stacked render actions. */
.ja-card img { width: 70px; height: 70px; display: block; object-fit: cover; background: #E7E1D5; outline: 1px solid var(--ja-line); outline-offset: -1px; }
.ja-card.is-on img { outline: 2px solid var(--ja-ink); outline-offset: 2px; }
.ja-acts.ja-acts-stack { flex-direction: column; align-items: stretch; }
.ja-acts.ja-acts-stack > button { flex: none; width: 100%; justify-content: center; }
.ja-acts > button[hidden] { display: none; }
/* DPA Frames: the product counter over the artwork, with arrows either side. */
#ja-prodnav { display: none; }
html.ja:not(.ja-adv):not(.ja-open) #ja-prodnav.is-on {
  display: flex; align-items: center; position: fixed; z-index: 44; left: 50%; transform: translateX(-50%);
  top: calc(var(--jm-bar, 52px) + env(safe-area-inset-top, 0px) + 8px); max-width: calc(100% - 32px);
  background: var(--ja-panel); border: 1px solid var(--ja-line); font-family: 'Familjen Grotesk', 'Inter', sans-serif; color: var(--ja-ink);
}
#ja-prodnav button { all: unset; width: 38px; height: 34px; display: grid; place-items: center; cursor: pointer; flex: none; }
#ja-prodnav button svg { width: 18px; height: 18px; }
#ja-prodnav button:focus-visible { outline: 2px solid var(--ja-blue); outline-offset: -2px; }
.ja-pn-t { padding: 0 6px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; border-left: 1px solid var(--ja-line); border-right: 1px solid var(--ja-line); line-height: 34px; }
.ja-rt-hint { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 28px; }
.ja-rt-hint[hidden] { display: none; }
/* Retouch fine controls: small tabs choosing what the big slider sets */
.ja-knobs { flex: none; display: flex; gap: 0; margin: 0 16px; border: 1px solid var(--ja-line); }
.ja-knobs[hidden] { display: none; }
.ja-knobs button { all: unset; box-sizing: border-box; flex: 1; height: 28px; display: grid; place-items: center; cursor: pointer; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ja-quiet); white-space: nowrap; padding: 0 6px; }
.ja-knobs button + button { border-left: 1px solid var(--ja-line); }
.ja-knobs button[aria-selected="true"] { background: var(--ja-ink); color: var(--ja-paper); }
.ja-knobs button:focus-visible { outline: 2px solid var(--ja-blue); outline-offset: -3px; }
.ja-chip.ja-mini[hidden] { display: none; }
#ja-panel[data-tool="retouch"] .ja-body { min-height: 236px; }
@media (max-height: 700px) { #ja-panel[data-tool="retouch"] .ja-body { min-height: 214px; } }
/* Loupe and split */
.ja-loupe { position: absolute; top: 34px; width: 120px; height: 120px; display: none; pointer-events: none; z-index: 2; filter: drop-shadow(0 8px 18px rgba(26,25,23,.28)); }
.ja-rt-zoom button[data-z="split"] { width: auto; padding: 0 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.ja-rt-zoom button[aria-pressed="true"] { background: var(--ja-ink); color: var(--ja-paper); }

/* Save sheet */
.ja-save-pv { flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; }
.ja-save-pv img { width: 56px; height: 56px; object-fit: contain; background: repeating-conic-gradient(#E6E1D6 0 25%, #F3F0E9 0 50%) 0 0 / 10px 10px; border: 1px solid var(--ja-line); flex: none; }
.ja-save-pv img:not([src]) { visibility: hidden; }
.ja-save-meta { margin: 0; font-size: 13px; font-weight: 600; color: var(--ja-ink); font-variant-numeric: tabular-nums; }
.ja-save-sub { margin: 2px 0 0; font-size: 11.5px; color: var(--ja-quiet); }
.ja-label { margin: 4px 0 0; padding: 0 16px; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ja-quiet); }
#ja-hold { position: fixed; inset: 0; z-index: 80; display: none; flex-direction: column; align-items: center; gap: 14px; padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); background: rgba(26,25,23,.94); overflow-y: auto; }
#ja-hold.is-on { display: flex; }
.ja-hold-h { margin: 0; color: #F3F0E9; font-size: 14px; text-align: center; }
.ja-hold-imgs { display: flex; flex-direction: column; gap: 12px; align-items: center; width: 100%; }
.ja-hold-imgs img { max-width: 100%; max-height: 62vh; -webkit-touch-callout: default; user-select: auto; }
#ja-hold .ja-second { flex: none; width: 100%; max-width: 360px; color: #F3F0E9; border-color: #F3F0E9; }
/* Guides over the artwork */
#ja-guides { position: fixed; z-index: 30; pointer-events: none; }
#ja-guides[hidden] { display: none; }
#ja-guides > div { position: absolute; left: 0; right: 0; display: none; }
#ja-guides.show-grid .ja-g-grid { display: block; inset: 0; background:
  linear-gradient(to right, transparent calc(33.333% - .5px), rgba(255,255,255,.75) calc(33.333% - .5px), rgba(255,255,255,.75) calc(33.333% + .5px), transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), rgba(255,255,255,.75) calc(66.666% - .5px), rgba(255,255,255,.75) calc(66.666% + .5px), transparent calc(66.666% + .5px)),
  linear-gradient(to bottom, transparent calc(33.333% - .5px), rgba(255,255,255,.75) calc(33.333% - .5px), rgba(255,255,255,.75) calc(33.333% + .5px), transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), rgba(255,255,255,.75) calc(66.666% - .5px), rgba(255,255,255,.75) calc(66.666% + .5px), transparent calc(66.666% + .5px));
  filter: drop-shadow(0 0 1px rgba(0,0,0,.4)); }
#ja-guides.show-safe .ja-g-top, #ja-guides.show-safe .ja-g-bot, #ja-guides.show-safe .ja-g-reel { display: flex; }
.ja-g-top { top: 0; height: 14%; background: rgba(199,57,31,.22); border-bottom: 1px dashed #C7391F; align-items: flex-end; }
.ja-g-bot { bottom: 0; height: 20%; background: rgba(199,57,31,.22); border-top: 1px dashed #C7391F; align-items: flex-start; }
.ja-g-reel { bottom: 20%; height: 15%; background: rgba(42,76,155,.16); border-top: 1px dashed #2A4C9B; align-items: flex-start; }
#ja-guides span { margin: 4px 6px; padding: 2px 5px; font-size: 9.5px; letter-spacing: .04em; color: #F3F0E9; background: rgba(26,25,23,.72); }
