/* "Edit every detail." — the live demos inside the four homepage tool cards.
   Each visual is a size container, so the scenes scale with the card at every
   breakpoint (the card's height comes from .tool-visual in home.css). The
   posters are rebuilt from their layers (clean plate + separated type or a
   cutout), so the part being edited is live, not a picture of it. */

@font-face { font-family: 'Bebas Neue'; src: url('../fonts/bebas-neue.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Cormorant; src: url('../fonts/cormorant-semibold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }

.vec-visual, .adjust-visual, .lang-visual, .type-visual {
  container-type: size; font-family: Inter, Arial, sans-serif; letter-spacing: 0;
}
.vec-visual, .type-visual {
  background-image: radial-gradient(#00000014 1px, transparent 1.2px); background-size: 18px 18px;
}
/* a poster on the canvas, and the layers it is rebuilt from */
.demo-stage { position: absolute; top: 50%; aspect-ratio: 3 / 4; height: 84cqh; transform: translate(-50%, -50%); left: 50%; }
.demo-poster {
  position: absolute; inset: 0; overflow: hidden; border-radius: 2px;
  box-shadow: 0 18px 38px color-mix(in srgb, #20182c 20%, transparent);
}
.demo-poster > img, .demo-poster > svg, .demo-poster > canvas {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover;
}
/* the editor's pointer, its tip at the element's origin */
.demo-cursor { position: absolute; z-index: 9; width: 22px; height: 26px; left: 0; top: 0; pointer-events: none; overflow: visible; transform-origin: 0 0; }
.demo-cursor svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 3px #0005); }
.demo-cursor .cur-arrow { fill: #fff; stroke: #151821; stroke-width: 1.5; transform: translate(-3px, -2px); }
.demo-cursor .cur-pen { fill: #fff; stroke: #151821; stroke-width: 1.4; stroke-linejoin: round; transform: translate(-3px, -21px); display: none; }
.demo-cursor[data-cursor="pen"] .cur-arrow { display: none; }
.demo-cursor[data-cursor="pen"] .cur-pen { display: block; }
.demo-cursor.is-down { scale: .88; }
/* a white floating panel, as the editor draws them */
.demo-panel {
  position: absolute; z-index: 6; padding: 8px 6px; border-radius: 10px; background: #fff; color: #2c2934;
  box-shadow: 0 10px 28px color-mix(in srgb, #20182c 16%, transparent); font-size: 11px;
}
.demo-panel-title { display: flex; align-items: center; gap: 6px; padding: 2px 6px 7px; color: #8c8996; font-size: 10.5px; }

/* ── 1 · Vector: the pen draws a loose, hand-made circle behind the type,
   the palette gives it an accent, then it is selected and scaled down. The
   chrome around the poster is the Studio's own — Layers on the left, the
   tool dock below, colour on the right. Geometry and timing: tool-demos.js. */
.vec-visual { background-color: #e1ebe9; }
.vec-visual .demo-stage { height: 76cqh; top: 45%; z-index: 7; } /* the pointer, inside it, visits the dock and palette */
.vec-edit { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 4; }
.vec-edit path, .vec-edit line, .vec-edit rect, .vec-edit circle { vector-effect: non-scaling-stroke; }
.vec-path { fill: none; stroke: #4a88ff; stroke-width: 1.5; }
.vec-rubber { fill: none; stroke: #4a88ff; stroke-width: 1; stroke-dasharray: 3 3; opacity: .8; }
.vec-handle { stroke: #4a88ff; stroke-width: 1; }
.vec-knob { fill: #4a88ff; }
.vec-anchor { fill: #fff; stroke: #4a88ff; stroke-width: 1.3; }
.vec-anchor.on { fill: #4a88ff; }
.vec-bbox { fill: none; stroke: #4a88ff; stroke-width: 1; }
.vec-corner { fill: #fff; stroke: #4a88ff; stroke-width: 1.2; }
/* Studio floating surfaces */
.vec-chrome {
  position: absolute; z-index: 6; background: #fff; border: 1px solid var(--neutral-150, #eceaf0); border-radius: 12px;
  box-shadow: 0 5px 18px color-mix(in srgb, var(--neutral-900, #25212c) 6%, transparent), 0 1px 3px color-mix(in srgb, var(--neutral-900, #25212c) 5%, transparent);
  color: var(--neutral-900, #25212c);
}
.vec-chrome svg { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
/* the dock: Select, Hand | Frame, Shape, Pen, Text — as in the editor */
.vec-dock { left: 50%; bottom: 3.6cqh; transform: translateX(-50%); display: flex; align-items: center; gap: 3px; padding: 5px; }
.vec-dock i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; color: var(--neutral-600, #5f5968); transition: background .2s, color .2s; }
.vec-dock i svg { width: 18px; height: 18px; }
.vec-dock .vec-sep { width: 1px; height: 18px; margin: 0 3px; background: var(--neutral-150, #eceaf0); }
.vec-visual[data-vec-tool="select"] .vec-dock [data-tool="select"],
.vec-visual[data-vec-tool="pen"] .vec-dock [data-tool="pen"] { background: #eae3f7; color: #57426f; }
/* Layers, with the editor's rows: the frame, then its layers front to back */
.vec-layers { left: max(10px, calc(50% - 28.5cqh - 160px)); top: 45%; transform: translateY(-50%); width: 146px; padding: 9px 7px 7px; font-size: 10px; }
.vec-layers h4 { margin: 0 2px 5px; font: 500 11.5px/1.4 Inter, Arial, sans-serif; letter-spacing: -.02em; }
.vec-layers > span {
  display: flex; align-items: center; gap: 4px; min-height: 24px; max-height: 24px; padding: 2px 4px 2px 12px;
  border-radius: 6px; line-height: 14px; white-space: nowrap; overflow: hidden;
  transition: background .2s, max-height .3s, min-height .3s, opacity .3s;
}
.vec-layers > span b { flex: none; display: grid; place-items: center; width: 16px; color: var(--neutral-600, #5f5968); transition: color .2s; }
.vec-layers > span b svg { width: 13px; height: 13px; }
.vec-layers > span em { font-style: normal; overflow: hidden; text-overflow: ellipsis; }
.vec-layers > .vec-frame-row { padding-left: 2px; font-size: 11px; font-weight: 600; line-height: 16px; }
.vec-visual[data-vec-layer="0"] .vec-layers [data-layer="path"] { min-height: 0; max-height: 0; padding-block: 0; opacity: 0; }
.vec-visual[data-vec-sel="1"] .vec-layers [data-layer="path"] { background: #efeaf9; }
.vec-visual[data-vec-sel="1"] .vec-layers [data-layer="path"] b { color: #7657a3; }
@container (max-width: 590px) { .vec-layers { display: none; } }
/* the colour column the editor floats beside a selection */
.vec-palette {
  left: calc(50% + 28.5cqh + 14px); top: 22%; display: grid; gap: 1.4cqh; padding: 1.3cqh; border-radius: 99px;
  opacity: 0; transform: translateX(-6px); transition: opacity .3s, transform .3s;
}
.vec-visual[data-vec-palette="1"] .vec-palette { opacity: 1; transform: none; }
.vec-palette i { display: block; width: 6.6cqh; height: 6.6cqh; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px #0000001a; transition: box-shadow .25s; }
.vec-visual[data-vec-accent="1"] .vec-palette i:first-child { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--neutral-900, #25212c); }

/* ── 2 · Image edit: the photo layer is redrawn from its own pixels as the
   sliders move — the type layer above it is untouched — and the histogram
   is counted from that same output. ──────────────────────────────────── */
.adjust-visual { background: #e9e4dc; }
.adjust-photo {
  position: absolute; left: 7cqw; top: 8cqh; bottom: 8cqh; aspect-ratio: 3 / 4;
  overflow: hidden; border-radius: 2px; background: #2a2622;
  box-shadow: 0 18px 36px color-mix(in srgb, #2a2133 22%, transparent);
}
.adjust-photo > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.adjust-photo canvas { opacity: 0; transition: opacity .3s; }
.adjust-visual.is-live .adjust-photo canvas { opacity: 1; }
.adjust-panel {
  position: absolute; right: 6cqw; top: 50%; transform: translateY(-50%);
  width: min(52cqw, 330px); padding: 14px 14px 10px; border-radius: 10px;
  background: #17151c; color: #ecebf1;
  box-shadow: 0 24px 50px color-mix(in srgb, #1c1625 30%, transparent);
}
.adjust-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.adjust-head > span:first-child { font-size: 13px; font-weight: 500; }
.adjust-look { font-size: 11px; color: #a9a6b5; white-space: nowrap; }
.adjust-graph { display: block; width: 100%; aspect-ratio: 2.3; margin-bottom: 8px; border-radius: 6px; background: #0d0c11; }
.adjust-row {
  display: grid; grid-template-columns: 74px minmax(0, 1fr) 28px; align-items: center; gap: 8px;
  min-height: 26px; font-size: 11px; color: #c9c6d3; cursor: pointer;
}
.adjust-row output { text-align: right; font-variant-numeric: tabular-nums; color: #ecebf1; }
/* the track is the input's own background (a 3px band); the fill runs from
   the centre to the value, the way the editor's bipolar sliders do */
.adjust-row input {
  --lo: 50%; --hi: 50%; --track: #ffffff26; --fill: #ffffff;
  -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 0; cursor: pointer; border-radius: 2px;
  background:
    linear-gradient(90deg, transparent 0 var(--lo), var(--fill) var(--lo) var(--hi), transparent var(--hi) 100%) center / 100% 3px no-repeat,
    linear-gradient(var(--track), var(--track)) center / 100% 3px no-repeat;
}
/* temperature and saturation show what they do on the track itself */
.adjust-row input[data-adjust="temperature"] { background: linear-gradient(90deg, #5b8cff, #e9e6dc, #ffbf47) center / 100% 3px no-repeat; }
.adjust-row input[data-adjust="saturation"] { background: linear-gradient(90deg, #8d8a95, #ff4f9a 70%, #ffb547) center / 100% 3px no-repeat; }
.adjust-row input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px #0008;
}
.adjust-row input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px #0008; }
.adjust-row input:focus-visible { outline: 2px solid #c9baff; outline-offset: 2px; }
@container (max-width: 400px) {
  .adjust-photo { left: 5cqw; top: 6cqh; bottom: auto; height: 62cqh; }
  .adjust-panel { right: 5cqw; top: auto; bottom: 5cqh; transform: none; width: 64cqw; padding: 11px 11px 7px; }
  .adjust-graph { aspect-ratio: 3.2; }
  .adjust-row { grid-template-columns: 64px minmax(0, 1fr) 24px; gap: 6px; min-height: 22px; font-size: 10px; }
}

/* ── 3 · Translation: every line of the poster is live type, set in the
   language picked (or the next one, on its own), refitted to its line. ── */
.lang-visual { background: #e4e2ec; }
/* poster and panel side by side, centred together; the panel never covers
   the poster, where a long translated line runs close to its edge */
.lang-visual .demo-stage { left: calc(50% - 76px); }
.lang-poster { container-type: inline-size; }
.lang-copy { position: absolute; inset: 0; text-align: center; transition: opacity .35s, filter .35s; }
.lang-visual.is-swapping .lang-copy { opacity: 0; filter: blur(5px); }
.lang-line { position: absolute; left: 0; right: 0; white-space: nowrap; }
.lang-title { font: 600 19.9cqw/1 Cormorant, Georgia, serif; letter-spacing: -.02em; color: #f4e8d6; }
.lang-sub {
  inset: auto 0; font: 600 2.22cqw/1.44 Cormorant, Georgia, serif; letter-spacing: .18em;
  text-transform: uppercase; color: #cbb07a;
}
/* positions measured against the original poster, in poster widths */
.lang-sub-top { top: 39.6cqw; }
/* the rule and star between title and tagline (drawn here, not in the photo, so it sits with the copy);
   centred 38.5cqw down, in the image's own pixel units across a 720-wide poster */
.demo-poster > .lang-ornament { inset: auto; position: absolute; left: 0; top: 37.1cqw; width: 100%; height: 2.78cqw; overflow: visible; pointer-events: none; }
.lang-ornament-rule { fill: none; stroke: #9d9382; stroke-width: 1.3; }
.lang-ornament-star { fill: #c8a45a; }
.lang-sub-bottom { top: 114.15cqw; font-size: 2cqw; line-height: 1.46; }
.lang-copy[lang="ja"] .lang-line { font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif; }
.lang-copy[lang="ja"] .lang-sub { letter-spacing: .1em; }
/* Arabic joins its letters: no tracking, no capitals */
.lang-copy[lang="ar"] .lang-line { font-family: "Geeza Pro", "Noto Naskh Arabic", "Amiri", "Times New Roman", serif; }
.lang-copy[lang="ar"] .lang-sub { letter-spacing: 0; font-size: 2.8cqw; }
.lang-copy[lang="ar"] .lang-title { letter-spacing: 0; } /* tracking breaks Arabic joining */
.lang-panel { left: calc(50% + 31.5cqh - 62px); top: 50%; transform: translateY(-50%); width: 150px; }
/* the editor's AI text menu, then its language list (with flags) */
.lang-view { display: grid; gap: 1px; animation: lang-view-in .28s ease both; }
.lang-view[hidden] { display: none; }
@keyframes lang-view-in { from { opacity: 0; transform: translateX(6px); } }
.lang-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 6px 8px; border: 0;
  border-radius: 6px; background: none; font: inherit; font-size: 11.5px; color: #3a3644; text-align: left; transition: background .2s, color .2s;
}
button.lang-item { cursor: pointer; }
button.lang-item:hover, .lang-item.is-hot { background: #f3f2f6; }
.lang-item[aria-pressed="true"] { background: #e7efff; color: #1f4fd6; }
.lang-item-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.lang-sep { height: 1px; margin: 4px 6px; background: #eceaf1; }
.lang-icon, .lang-chev, .lang-check { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lang-icon { width: 13px; height: 13px; stroke-width: 1.6; color: #8c8996; }
.lang-chev { color: #9a97a3; }
.lang-check { opacity: 0; }
.lang-item[aria-pressed="true"] .lang-check { opacity: 1; }
.lang-flag { width: 16px; height: 11px; flex: none; border-radius: 2px; box-shadow: 0 0 0 .5px rgb(0 0 0 / 16%); }
.lang-back {
  display: flex; align-items: center; gap: 5px; width: 100%; margin-bottom: 3px; padding: 2px 6px 7px; border: 0;
  border-bottom: 1px solid #eceaf1; background: none; font: inherit; font-size: 10.5px; color: #8c8996; text-align: left; cursor: pointer;
}
.lang-back:hover { color: #3a3644; }
@container (max-width: 430px) {
  .lang-visual .demo-stage { left: 50%; }
  .lang-panel { left: auto; right: 10px; top: 10px; transform: none; width: auto; padding: 4px; }
  .lang-sep, .lang-back, .lang-menu .lang-item:not(.is-hot), .lang-list .lang-item:not([aria-pressed="true"]) { display: none; }
  .lang-menu:not(:has(.is-hot)) .lang-open { display: flex; }
}

/* ── 4 · Type: big type behind the subject — retyped, recoloured and
   resized in place while the cutout stays in front of it. ────────────── */
.type-visual { background-color: #ecebef; }
.type-visual .demo-stage { aspect-ratio: 4 / 5; height: 78cqh; top: 55%; }
.type-poster { container-type: inline-size; }
.type-title {
  position: absolute; left: 3.6cqw; top: 0; transform-origin: 0 8.9cqw;
  transform: scale(var(--k, 1)); transition: transform .12s linear;
  font: 400 34.13cqw/1 "Bebas Neue", "Arial Narrow", sans-serif; letter-spacing: -.02em;
  text-transform: uppercase; color: #141414; white-space: nowrap;
}
.type-line { position: absolute; left: 0; display: block; }
/* sizes and baselines measured from the original poster (Bebas Neue's cap
   height is .7em, so a line's cap top sits .1em below its box) */
.type-l1 { top: 8.9cqw; }
.type-l2 {
  top: 35.86cqw; font-size: .8605em;
  background: linear-gradient(#141414, #4c4c4c) 0 0 / 100% 100%; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.type-visual[data-type-color="red"] .type-l2 { background-image: linear-gradient(#e2372c, #b8211b); }
.type-caret { display: inline-block; width: .04em; height: .72em; margin-left: .03em; vertical-align: .02em; background: #141414; opacity: 0; }
.type-visual[data-type-phase="typing"] .type-caret { animation: type-blink 1s steps(1) infinite; }
@keyframes type-blink { 50% { opacity: 1; } }
.demo-poster > .type-model { inset: auto; left: 30.926%; top: 12.815%; width: 49.537%; height: auto; z-index: 2; }
/* the selection is drawn over the subject, so it sits outside the poster */
.type-sel { position: absolute; z-index: 5; border: 1px solid #4a88ff; opacity: 0; transition: opacity .2s; pointer-events: none; }
.type-visual[data-type-sel="1"] .type-sel { opacity: 1; }
.type-sel i { position: absolute; width: 6px; height: 6px; background: #fff; border: 1px solid #4a88ff; }
.type-sel i:nth-child(1) { left: -3.5px; top: -3.5px; } .type-sel i:nth-child(2) { right: -3.5px; top: -3.5px; }
.type-sel i:nth-child(3) { left: -3.5px; bottom: -3.5px; } .type-sel i:nth-child(4) { right: -3.5px; bottom: -3.5px; }
.type-bar {
  left: 0; bottom: calc(100% + 8px); display: flex; align-items: center; gap: 2px; padding: 4px; white-space: nowrap;
  opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s;
}
.type-visual[data-type-bar="1"] .type-bar { opacity: 1; transform: none; }
.type-bar > span { display: flex; align-items: center; gap: 5px; height: 24px; padding: 0 7px; border-radius: 6px; font-size: 11px; color: #3a3644; }
.type-bar > span + span { border-left: 1px solid #eeedf2; border-radius: 0 6px 6px 0; }
.type-bar b { font: 400 14px/1 "Bebas Neue", "Arial Narrow", sans-serif; }
.type-bar [data-type-size] { min-width: 26px; font-variant-numeric: tabular-nums; }
.type-bar .type-swatch { width: 14px; height: 14px; border-radius: 4px; background: #141414; box-shadow: inset 0 0 0 1px #0002; transition: background .3s; }
.type-visual[data-type-color="red"] .type-swatch { background: #e2372c; }
.type-visual[data-type-hot="size"] [data-type-size], .type-visual[data-type-hot="color"] .type-swatch-wrap { background: #e7efff; color: #1f4fd6; }
@container (max-width: 380px) { .type-bar [data-type-weight] { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .lang-copy, .type-title, .adjust-photo canvas { transition: none; }
  .lang-view { animation: none; }
}
