/* Framekeep — one visual system for home, documents and the editor.
   Product-photo studio: warm paper and stone, dark ink, one restrained accent (deep teal),
   photographs and results as the largest things on every screen. System fonts only. */

:root {
  --paper: #f5f7fa;
  --paper-2: #edf1f5;
  --surface: #ffffff;
  --ink: #15212d;
  --ink-2: #344657;
  --muted: #526273;
  --line: #dce3e9;
  --line-strong: #9caab7;
  --accent: #08796f;
  --accent-hover: #075c55;
  --accent-ink: #ffffff;
  --accent-soft: #e4f4ef;
  --ok: #2f6b45;
  --ok-soft: #e1ede4;
  --cut: #b4441a;
  --cut-soft: #f6e4da;
  --lost: #6d3f8f;
  --lost-soft: #ece2f1;
  --err: #a3202f;
  --err-soft: #f6e0e2;
  --none: #6f675c;
  --none-soft: #ebe6de;

  --s1: 8px; --s2: 12px; --s3: 20px; --s4: 32px; --s5: 48px; --s6: 80px;
  --r-ctl: 6px;
  --r-media: 10px;
  --shadow-stage: 0 1px 2px rgba(29, 26, 22, 0.08), 0 8px 24px rgba(29, 26, 22, 0.08);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font);
  --t-xs: 0.8125rem;
  --t-sm: 0.9375rem;
  --t-md: 1rem;
  --t-lg: 1.1875rem;
  --t-xl: 1.5rem;
  --t-2xl: clamp(1.75rem, 1.3rem + 1.6vw, 2.25rem);
  --t-3xl: clamp(2.1rem, 1.4rem + 3vw, 3.4rem);
  color-scheme: light;
}
:lang(ja) { --font: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans CJK JP", sans-serif; --font-display: var(--font); }
:lang(ko) { --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", sans-serif; --font-display: var(--font); }
:lang(zh-Hans) { --font: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; --font-display: var(--font); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-bottom: 6rem; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: var(--t-md); line-height: 1.55; overflow-wrap: anywhere; }
:lang(ja), :lang(zh-Hans) { line-break: strict; }
:lang(ko) { word-break: keep-all; }
/* R6: a restrained studio system; motion explains a selection, never gates an action. */
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .06em; color: var(--accent); margin: 0 0 12px; }
.protection-panel { margin: 0 0 20px; }
.zone-switch { display: grid; gap: 6px; margin-bottom: 10px; }
.zone-button { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 9px; min-height: 48px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .875rem; text-align: left; color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.zone-button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.zone-button:disabled { cursor: not-allowed; opacity: .6; }
.zone-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.zone-1 { background: #b47633; }.zone-2 { background: #78608c; }
.zone-state { font-size: .7rem; color: var(--muted); }
.zone-state[data-status="inside"] { color: var(--ok); }.zone-state[data-status="cut"],.zone-state[data-status="lost"] { color: var(--cut); }
.studio-detail { border-top: 1px solid var(--line); padding: 16px 0; margin-top: 10px; }
.studio-detail summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.studio-detail summary::after { content: '+'; font-size: 1.25rem; font-weight: 400; }.studio-detail[open] summary::after { content: '−'; }
.studio-detail p { margin: 12px 0; }.studio-detail select { min-height: 44px; margin: 0 0 12px; }
.shelf-cards { display: flex; gap: 12px; max-width: 100%; overflow-x: auto; padding: 10px 0; }
.shelf-cards figure { flex: 0 0 auto; margin: 0; background: #e7e2d9; border-radius: 8px; padding: 8px; }
.shelf-cards canvas { max-width: none; border-radius: 4px; }
.shelf-cards figcaption { font-size: .75rem; padding-top: 8px; text-align: center; color: var(--muted); }
.style-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.delivery-panel { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.delivery-panel h3 { font-size: 1rem; }
.delivery-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; align-items: start; margin: 16px 0; }
.delivery-cards figure { margin: 0; min-width: 0; }
.delivery-cards canvas { background: var(--paper-2); border: 1px solid var(--line); border-radius: 5px; }
.delivery-cards figcaption { font-size: .65rem; line-height: 1.5; padding-top: 7px; }
.delivery-cards figcaption span,.delivery-cards figcaption small { display: block; font-size: inherit; }.delivery-cards figcaption small { color: var(--ok); }
.evolution-section { padding-top: 72px; padding-bottom: 56px; }
.evolution-section h2 { max-width: 32rem; font-size: clamp(1.6rem,3vw,2.4rem); margin-bottom: 30px; }
.feature-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.feature-card { position: relative; background: var(--surface); border: 1px solid var(--line); padding: 24px; border-radius: 16px; overflow: hidden; }
.feature-number { font-size: .75rem; color: var(--accent); margin-bottom: 24px; display: block; font-variant-numeric: tabular-nums; }
.feature-card h3 { font-size: 1.25rem; }.feature-card p { font-size: .9375rem; color: var(--muted); min-height: 72px; }
.feature-visual { height: 180px; border-radius: 9px; overflow: hidden; position: relative; margin-top: 24px; background: var(--paper-2); }
.feature-visual img { height: 100%; width: 100%; object-fit: cover; }
.feature-visual-0 span { position: absolute; left: 32%; top: 15%; width: 37%; height: 74%; border: 2px solid var(--accent); box-shadow: 0 0 0 100px #ffffff30; }
.feature-visual-1 img { width: 120px; height: 120px; object-fit: cover; margin: 30px auto; border: 5px solid var(--surface); border-radius: 6px; }
.feature-visual-2 img { width: 66%; object-fit: contain; margin: auto; }.feature-visual-2 span { position: absolute; inset: 16px 23%; border: 1px dashed var(--accent); border-radius: 5px; }
.return-work { display: flex; align-items: center; gap: 20px; border-top: 1px solid var(--line); padding: 24px 0; margin-top: 30px; color: var(--ink-2); }
.return-work > span { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; font-size: 1.5rem; color: var(--accent); }.return-work p { margin: 0; max-width: 48rem; }
.hero h1 { white-space: pre-line; }.hero .lead { max-width: 33rem; }
.zone-state { max-width: 100px; text-align: right; line-height: 1.4; }
.app:not([data-view="shelf"]) [data-view-panel="shelf"],.app[data-view="shelf"] [data-view-panel="result"],.app[data-view="shelf"] [data-view-panel="compare"] { display: none !important; }
.shelf-stage { padding: 20px 8px; min-height: 320px; }.shelf-stage .shelf-cards { align-items: flex-start; justify-content: flex-start; padding: 20px 0; }
.export-modes { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 8px; background: var(--paper-2); gap: 4px; margin: 16px 0; }
.export-modes button { border: 1px solid transparent; border-radius: 6px; background: transparent; padding: 10px 6px; min-height: 44px; font: inherit; font-size: .875rem; color: var(--muted); cursor: pointer; }
.export-modes button[aria-pressed="true"] { background: var(--surface); border-color: var(--line-strong); color: var(--accent); font-weight: 650; }
.delivery-panel { margin: 0 0 18px; border: 0; padding: 0; }
.set-stage-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; align-items: start; padding: 16px 0; }
.set-stage-cards figure { margin: 0; min-width: 0; padding: 8px; background: var(--paper-2); border-radius: 8px; }.set-stage-cards canvas { border-radius: 4px; }
.set-stage-cards figcaption { text-align: center; font-size: .8125rem; color: var(--muted); margin-top: 10px; }
.view-toggle .seg-btn { min-width: 0; flex: 1; padding-inline: 10px; }
@media(max-width:600px) { .view-toggle .seg-btn { font-size: .75rem; padding-inline: 6px; }.set-stage-cards { gap: 6px; }.set-stage-cards figure { padding: 5px; } }
@keyframes studio-enter { from { opacity: .5; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.studio [data-panel]:not([hidden]),.studio-detail[open] .shelf-cards { animation: studio-enter .18s ease-out; }
.btn { transition: background-color .15s, border-color .15s, box-shadow .15s; }
@media(max-width:700px) { .feature-grid { grid-template-columns: 1fr; }.feature-card p { min-height: 0; }.evolution-section { padding-top: 44px; }.feature-visual { height: 210px; }.feature-visual-1 img { margin-top: 45px; }.delivery-panel { padding-bottom: 16px; } }
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
:lang(ja) body, :lang(ko) body, :lang(zh-Hans) body { line-height: 1.7; }
a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--s2); color: var(--ink); }
h1 { font-family: var(--font-display); font-size: var(--t-3xl); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: var(--t-xl); font-weight: 700; }
h3 { font-size: var(--t-lg); font-weight: 700; }
p { margin: 0 0 var(--s2); }
img, svg, canvas { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.vh { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; float: none !important; }
.skip { position: absolute; left: var(--s1); top: -4rem; z-index: 50; background: var(--surface); padding: var(--s1) var(--s2); border: 2px solid var(--accent); border-radius: var(--r-ctl); }
.skip:focus { top: var(--s1); }
.fine { font-size: var(--t-xs); color: var(--muted); line-height: 1.5; }
.meta { font-size: var(--t-xs); color: var(--muted); font-variant-numeric: tabular-nums; margin: var(--s1) 0 0; }
.lead { font-size: var(--t-lg); color: var(--ink-2); max-width: 36rem; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  min-height: 44px; padding: 0 var(--s3);
  border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: var(--t-sm); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.accent { border-color: var(--accent); color: var(--accent); }
.btn.accent:hover { background: var(--accent-soft); }
.btn.accent[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.quiet:hover { border-color: var(--line-strong); }
.btn.small { padding: 0 var(--s2); }
.btn.large { min-height: 52px; padding: 0 var(--s4); font-size: var(--t-md); }
.btn.block { width: 100%; }
.btn.icon { min-width: 44px; padding: 0; font-size: 1.15rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: var(--s3) 0 var(--s2); }
.row { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; margin: var(--s2) 0; }
.row.tight { margin: var(--s1) 0; }
.row.end { justify-content: flex-end; }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 var(--s2); border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); cursor: pointer; font-size: var(--t-sm); }
.chip:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 650; }
.chip input[type="radio"] { margin: 0; accent-color: var(--accent); }
.chip input[type="color"] { width: 28px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }
.swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line-strong); }
.swatch-0 { background: #ffffff; }
.swatch-1 { background: #eef0f3; }
.swatch-2 { background: #000000; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 0; margin: 0; padding: 0; min-width: 0; }
.seg-btn { min-height: 44px; padding: 0 var(--s3); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font: inherit; font-size: var(--t-sm); font-weight: 600; cursor: pointer; }
.seg-btn:first-child { border-radius: var(--r-ctl) 0 0 var(--r-ctl); }
.seg-btn:last-child { border-radius: 0 var(--r-ctl) var(--r-ctl) 0; margin-left: -1px; }
.seg-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.group { margin-top: var(--s3); }
.group > legend { font-weight: 700; font-size: var(--t-sm); padding: 0; margin-bottom: var(--s1); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-xs); color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: var(--s1); }
.field input, .field select, .num-input {
  font: inherit; font-size: var(--t-md); color: var(--ink); min-height: 44px; padding: 0 var(--s2);
  border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: #fff; width: 100%; font-variant-numeric: tabular-nums;
}
.field.inline select { width: auto; }
.num-input { width: 5.5rem; }
.field-label { display: block; font-size: var(--t-xs); color: var(--muted); margin-bottom: 4px; }
[aria-invalid="true"] { border: 2px solid var(--err) !important; background: var(--err-soft) !important; }
.err { color: var(--err); font-weight: 600; font-size: var(--t-sm); margin: var(--s1) 0; }
.err:empty { display: none; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); gap: var(--s1); margin: var(--s1) 0; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: var(--t-xs); font-weight: 700; line-height: 1.5; }
.badge .icon, .status-msg .icon { font-weight: 800; }
[data-status="inside"].badge, .demo-v[data-status="inside"] { color: var(--ok); background: var(--ok-soft); }
[data-status="cut"].badge, .demo-v[data-status="cut"] { color: var(--cut); background: var(--cut-soft); }
[data-status="lost"].badge { color: var(--lost); background: var(--lost-soft); }
[data-status="invalid"].badge { color: var(--err); background: var(--err-soft); }
[data-status="none"].badge { color: var(--none); background: var(--none-soft); }

/* ---------- header / footer ---------- */
.site-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); padding: var(--s2) clamp(16px, 3vw, 40px); border-bottom: 1px solid var(--line); background: var(--paper); }
.brand { display: inline-flex; align-items: baseline; gap: 10px; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand-mark { width: 20px; height: 20px; align-self: center; flex: none; background:
  linear-gradient(var(--accent), var(--accent)) 0 5px / 15px 2px no-repeat,
  linear-gradient(var(--accent), var(--accent)) 5px 0 / 2px 15px no-repeat,
  linear-gradient(var(--accent), var(--accent)) 5px 18px / 15px 2px no-repeat,
  linear-gradient(var(--accent), var(--accent)) 18px 5px / 2px 15px no-repeat; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: 0.01em; }
.brand-desc { font-size: var(--t-xs); color: var(--muted); }
.site-nav a, .lang-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; font-size: var(--t-sm); }
.site-nav a:hover, .lang-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="page"] { font-weight: 700; }
.lang-nav { display: flex; align-items: center; gap: var(--s1); }
.lang-label { font-size: var(--t-xs); color: var(--muted); }
.lang-nav ul { display: flex; flex-wrap: wrap; gap: 0 var(--s2); list-style: none; margin: 0; padding: 0; }
.lang-nav a[aria-current="true"] { font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; }
.site-foot { padding: var(--s4) clamp(16px, 3vw, 40px) var(--s5); color: var(--muted); font-size: var(--t-xs); border-top: 1px solid var(--line); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 0 var(--s3); }
.site-foot a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-2); }

/* ---------- home ---------- */
.home { max-width: 76rem; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px); }
.hero { display: grid; gap: var(--s4); align-items: center; padding: var(--s5) 0 var(--s5); }
@media (min-width: 960px) { .hero { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--s5); padding-top: var(--s4); align-items: start; } .hero-copy { padding-top: var(--s5); } }
.hero h1 { max-width: 14ch; }
:lang(ja) .hero h1, :lang(ko) .hero h1, :lang(zh-Hans) .hero h1 { max-width: 18em; font-weight: 800; letter-spacing: 0; line-height: 1.3; font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.8rem); }

.demo { margin: 0; }
.demo-toggle { display: flex; margin-bottom: var(--s2); }
.demo-stage { position: relative; display: flex; justify-content: center; background: var(--paper-2); border-radius: var(--r-media); overflow: hidden; box-shadow: var(--shadow-stage); }
.demo-fallback { width: 100%; height: auto; }
.demo-canvas { display: none; }
.demo.is-live .demo-fallback { display: none; }
.demo.is-live .demo-canvas { display: block; }
.demo-strip { list-style: none; margin: var(--s2) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.demo-pv-frame { height: 112px; display: flex; align-items: center; justify-content: center; background: var(--paper-2); border-radius: var(--r-ctl); }
.demo-pv p { margin: 6px 0 0; font-size: var(--t-xs); }
.demo-pv-name { font-weight: 700; }
.demo-v { display: inline-block; padding: 0 6px; border-radius: 999px; font-weight: 700; }
.demo-cut { color: var(--cut); font-weight: 600; }
.demo-cut:empty { display: none; }
.demo figcaption { margin-top: var(--s2); font-size: var(--t-xs); color: var(--muted); }
.demo-state { display: block; font-size: var(--t-sm); font-weight: 700; color: var(--ink); }
.demo[data-status="cut"] .demo-state { color: var(--cut); }
.demo[data-status="inside"] .demo-state { color: var(--ok); }

.band { padding: var(--s5) 0; border-top: 1px solid var(--line); }
.steps-list { list-style: none; margin: var(--s3) 0 0; padding: 0; display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.steps-list h3 { margin: var(--s2) 0 var(--s1); }
.steps-list p { color: var(--ink-2); }
.step-n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--ink); font-size: var(--t-xs); font-weight: 800; flex: none; }
.split { display: grid; gap: var(--s5); }
@media (min-width: 960px) { .split { grid-template-columns: 1fr 1fr; } }
.split p { color: var(--ink-2); max-width: 38rem; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary { min-height: 52px; display: flex; align-items: center; cursor: pointer; font-weight: 650; }
.faq-item p { color: var(--ink-2); padding-bottom: var(--s2); }
.sources ul { list-style: none; padding: 0; margin: 0; }
.sources li p { color: var(--muted); font-size: var(--t-sm); margin-top: 4px; }

/* ---------- documents ---------- */
.prose-page { max-width: 76rem; margin: 0 auto; padding: var(--s5) clamp(16px, 3vw, 40px); }
.prose { max-width: 42rem; }
.prose h1 { font-size: var(--t-2xl); margin-bottom: var(--s3); }
.prose h2 { margin-top: var(--s4); font-size: var(--t-lg); }
.prose p, .prose li { color: var(--ink-2); }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: var(--s1); }
.chooser { max-width: 36rem; margin: 0 auto; padding: var(--s6) 16px; }
.chooser h1 { display: flex; gap: var(--s2); align-items: center; font-size: var(--t-2xl); }
.chooser-list { list-style: none; padding: 0; margin: var(--s3) 0 0; display: grid; gap: var(--s1); }
.chooser-list a { display: flex; flex-direction: column; padding: var(--s2) var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-media); color: var(--ink); text-decoration: none; }
.chooser-list a:hover { border-color: var(--ink); }
.ch-lang { font-weight: 700; }
.ch-name { color: var(--muted); font-size: var(--t-sm); }

/* ---------- editor: start ---------- */
.app { max-width: 100rem; margin: 0 auto; padding: 0 clamp(12px, 2vw, 32px); }
.intake { padding: var(--s4) 0 var(--s5); }
.dropzone { display: grid; gap: var(--s4); align-items: center; padding: var(--s4); border: 2px dashed var(--line-strong); border-radius: var(--r-media); background: var(--surface); }
@media (min-width: 900px) { .dropzone { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: var(--s5); } }
.intake h2 { font-family: var(--font-display); font-size: var(--t-2xl); font-weight: 600; }
:lang(ja) .intake h2, :lang(ko) .intake h2, :lang(zh-Hans) .intake h2 { font-weight: 800; }
.intake-figure { margin: 0; }
.intake-figure img { border-radius: var(--r-media); width: 100%; height: auto; }
.intake-figure figcaption { margin-top: var(--s1); }
.dropzone:has(#file:focus-visible) label[for="file"] { outline: 3px solid var(--accent); outline-offset: 3px; }
.dropzone.is-drop, .studio.is-drop { outline: 3px dashed var(--accent); outline-offset: 4px; }

/* ---------- editor: studio ---------- */
.studio { display: grid; gap: var(--s2) var(--s3); padding: var(--s2) 0 var(--s3); grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "stage" "film" "insp"; }
.studio-bar { grid-area: bar; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s1); }
.stage { grid-area: stage; min-width: 0; }
.filmstrip { grid-area: film; min-width: 0; }
.inspector { grid-area: insp; min-width: 0; }
@media (min-width: 1024px) {
  .studio { grid-template-columns: 10.5rem minmax(0, 1fr) 21rem; grid-template-areas: "bar bar bar" "film stage insp"; align-items: start; }
}
@media (min-width: 1400px) { .studio { grid-template-columns: 12rem minmax(0, 1fr) 23rem; } }

.steps { display: flex; gap: 2px; background: var(--paper-2); padding: 3px; border-radius: calc(var(--r-ctl) + 3px); max-width: 100%; overflow-x: auto; }
.step-tab { display: inline-flex; align-items: center; gap: var(--s1); min-height: 44px; padding: 0 var(--s3) 0 var(--s2); border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--ink-2); font: inherit; font-size: var(--t-sm); font-weight: 650; cursor: pointer; white-space: nowrap; }
.step-tab:hover { color: var(--ink); }
.step-tab[aria-current="step"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(29, 26, 22, 0.12); }
.step-tab[aria-current="step"] .step-n { background: var(--ink); color: #fff; }
.step-tab .step-n { width: 22px; height: 22px; }
.studio-actions { display: flex; flex-wrap: wrap; gap: 4px; }

/* panels follow the current step / view */
.app[data-step="mark"] [data-panel]:not([data-panel="mark"]),
.app[data-step="check"] [data-panel]:not([data-panel="check"]),
.app[data-step="save"] [data-panel]:not([data-panel="save"]) { display: none !important; }
.app[data-view="result"] [data-view-panel="compare"],
.app[data-view="compare"] [data-view-panel="result"] { display: none !important; }

.stage-panel { background: var(--surface); border-radius: var(--r-media); box-shadow: var(--shadow-stage); padding: var(--s2); }
.draw-hint { margin: 0 0 var(--s1); padding: var(--s1) var(--s2); border-radius: var(--r-ctl); font-size: var(--t-sm); font-weight: 600; color: var(--ink); background: var(--paper); border-left: 3px solid var(--accent); }
.draw-hint[data-mode="drawing"] { background: var(--accent); color: var(--accent-ink); }
.draw-hint[data-mode="example"] { border-left-color: var(--cut); }
.draw-hint[data-mode="done"] { font-weight: 500; color: var(--ink-2); border-left-color: var(--line-strong); font-size: var(--t-xs); }
.stage-scroll { overflow: auto; max-width: 100%; display: flex; background: var(--paper-2); border-radius: var(--r-ctl); padding: var(--s1); }
#editor { margin: auto; touch-action: none; cursor: crosshair; }
.tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); margin-top: var(--s1); }
.zoom { display: flex; gap: 4px; margin-left: auto; }
.view-toggle { display: flex; margin-bottom: var(--s1); }
.result-frame { display: flex; justify-content: center; background: var(--paper-2); border-radius: var(--r-ctl); padding: var(--s1); }
.result-frame canvas { box-shadow: 0 0 0 1px var(--line-strong); }
.legend { margin: var(--s1) 0 0; font-size: var(--t-xs); color: var(--muted); }
.compare-view .cmp-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); margin: var(--s1) 0; }
.compare-view figure { margin: 0; }
.cmp-frame { height: min(46vh, 26rem); display: flex; align-items: center; justify-content: center; background: var(--paper-2); border-radius: var(--r-ctl); padding: var(--s1); }
.cmp-frame canvas { box-shadow: 0 0 0 1px var(--line-strong); }
.compare-view figcaption { display: flex; gap: var(--s1); align-items: center; margin-top: 6px; font-size: var(--t-sm); font-weight: 600; }

/* filmstrip: three crops, the saved one marked */
.pv-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s1); }
.pv figure { margin: 0; }
.pv { padding: 6px; border-radius: var(--r-ctl); border: 1px solid transparent; }
.pv[data-output="true"] { border-color: var(--ink); background: var(--surface); }
.pv-frame { height: 112px; display: flex; align-items: center; justify-content: center; background: var(--paper-2); border-radius: 4px; }
.pv-frame canvas { box-shadow: 0 0 0 1px var(--line-strong); }
.pv[data-output="true"] .pv-frame canvas { cursor: grab; touch-action: none; }
.pv figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin-top: 6px; font-size: var(--t-xs); line-height: 1.35; }
.pv-name { font-weight: 700; }
.pv-kind { flex-basis: 100%; color: var(--muted); }
.pv[data-output="true"] .pv-kind { color: var(--ink); font-weight: 700; }
.pv-cut { flex-basis: 100%; color: var(--cut); font-weight: 600; }
.pv-cut:empty { display: none; }
.sim-note { margin: var(--s1) 0 0; }
@media (min-width: 1024px) {
  .pv-list { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
  .pv-frame { height: 112px; }
  /* the centre-crop meaning is explained once in .sim-note; only the saved ratio keeps its line */
  .pv:not([data-output="true"]) .pv-kind { display: none; }
}

/* inspector */
.insp-title { font-size: var(--t-lg); margin-bottom: var(--s2); }
.insp-sub { font-size: var(--t-sm); margin: 0 0 6px; }
.area-info { font-weight: 650; font-variant-numeric: tabular-nums; }
.area-info[data-state="none"] { display: none; }
.area-info[data-state="example"] { color: var(--cut); }
.inline-details { margin-top: var(--s2); border-top: 1px solid var(--line); }
.inline-details > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 650; font-size: var(--t-sm); color: var(--ink); }
.example-note { font-size: var(--t-xs); color: var(--ink-2); border-left: 3px solid var(--cut); padding-left: var(--s2); }
.status-msg { display: flex; gap: var(--s1); align-items: flex-start; margin: 0 0 var(--s2); font-weight: 650; font-size: var(--t-sm); }
.status-msg[data-status="inside"] { color: var(--ok); }
.status-msg[data-status="cut"] { color: var(--cut); }
.status-msg[data-status="lost"] { color: var(--lost); }
.status-msg[data-status="invalid"] { color: var(--err); }
.status-msg[data-status="none"] { color: var(--muted); }
.suggest { padding: var(--s2); border-radius: var(--r-ctl); background: var(--paper); border: 1px solid var(--line); }
.suggest[data-kind="suggest"] { border-color: var(--accent); background: var(--accent-soft); }
.suggest-text { font-size: var(--t-sm); margin-bottom: var(--s1); }
.suggest-preview { margin: 0 0 var(--s1); }
.suggest-preview:not([hidden]) { display: flex; gap: var(--s2); align-items: flex-end; }
.suggest-frame { width: 7.5rem; flex: none; }
.suggest-frame canvas { box-shadow: 0 0 0 1px var(--line-strong); }
.spec { margin: 0 0 var(--s3); display: grid; gap: 0; }
.spec div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s2); padding: var(--s1) 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.spec dt { white-space: nowrap; }
.spec dt { color: var(--muted); }
.spec dd { margin: 0; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
#res-check[data-status="inside"] { color: var(--ok); }
#res-check[data-status="cut"] { color: var(--cut); }
#res-check[data-status="lost"] { color: var(--lost); }

/* action bar */
.savebar { position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; gap: var(--s2); margin: 0 calc(-1 * clamp(12px, 2vw, 32px)); padding: var(--s1) clamp(12px, 2vw, 32px); background: rgba(251, 249, 245, 0.97); border-top: 1px solid var(--line-strong); min-height: 60px; }
.save-text { flex: 1 1 auto; min-width: 0; }
.save-reason, .notice { margin: 0; font-size: var(--t-xs); color: var(--ink-2); }
.save-reason:empty, .notice:empty { display: none; }
.save-reason[data-status="cut"] { color: var(--cut); }
.save-reason[data-status="lost"] { color: var(--lost); }
.save-reason[data-status="invalid"] { color: var(--err); }
.notice[data-kind="error"] { color: var(--err); font-weight: 650; }
.notice[data-kind="ok"] { color: var(--ok); font-weight: 650; }
/* routine status (e.g. "Ready to edit") is announced but not shown */
.notice[data-kind="quiet"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hist-i { font-size: 1.1rem; line-height: 1; }
.app[data-step="save"][data-export-mode="set"] .filmstrip { display: none; }
.app[data-step="save"][data-export-mode="set"] .studio { grid-template-areas: "bar" "stage" "insp"; }
@media(min-width:1024px) { .app[data-step="save"][data-export-mode="set"] .studio { grid-template-columns: minmax(0,1fr) 21rem; grid-template-areas: "bar bar" "stage insp"; } }
.delivery-cards { grid-template-columns: 1fr; gap: 0; }
.delivery-cards figcaption { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 3px 10px; font-size: .8125rem; padding: 12px 0; border-bottom: 1px solid var(--line); }
.delivery-cards figcaption small { grid-column: 2; }
.savebar #next-step { flex: none; }

/* start screen: the action bar only appears to show a message */
.app[data-state="empty"] .savebar:has(.notice:empty) { display: none; }
.app[data-state="empty"] .save-reason { display: none; }

dialog { border: 1px solid var(--line-strong); border-radius: var(--r-media); padding: var(--s3); max-width: min(32rem, calc(100vw - 2rem)); color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgba(29, 26, 22, 0.45); }
dialog p { font-weight: 600; }

@media (max-width: 600px) {
  /* Reserve room for the wrapped action/notice bar when native focus scrolls. */
  html { scroll-padding-bottom: 9rem; }
  .site-head { gap: 0 var(--s2); padding-block: 4px; }
  .brand-desc { display: none; }
  .lang-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .step-tab { justify-content: center; padding: 0 6px; gap: 6px; white-space: normal; text-align: left; line-height: 1.2; font-size: var(--t-xs); }
  .studio-actions { width: 100%; }
  .studio-actions .btn { font-size: var(--t-xs); }
  .btn.hist { min-width: 44px; padding: 0; }
  .hist-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .studio-actions .btn.quiet { padding: 0 var(--s1); }
  .stage-panel { padding: var(--s1); box-shadow: none; }
  .pv-frame { height: 108px; }
  .savebar { gap: var(--s1); }
  .save-reason, .notice { font-size: 0.75rem; line-height: 1.35; }
  .dropzone { padding: var(--s3); }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}


/* R7: diagnosis first, optional adjustment second. */
.loss-review { margin: 16px 0; }
.loss-review h3 { font-size: .9375rem; margin: 0 0 8px; }
.loss-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .75rem; }
.loss-table th,.loss-table td { padding: 8px 3px; text-align: center; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; vertical-align: top; }
.loss-table th:first-child { width: 23%; text-align: left; font-weight: 600; }
.loss-table thead { color: var(--muted); }
.loss-table td span { font-weight: 650; }
.loss-table td small { display: block; margin-top: 3px; font-size: .6875rem; line-height: 1.4; }
.loss-table td[data-status="inside"] { color: var(--ok); }
.loss-table td[data-status="cut"],.loss-table td[data-status="invalid"] { color: var(--cut); }
.loss-table td[data-status="lost"] { color: var(--lost); }
#tweak-review > summary { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; }
#tweak-values { font-size: .6875rem; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
#tweak-values[data-invalid="true"] { color: var(--err); }
.suggest-action-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.suggest-action-row .suggest-frame { width: 4.5rem; }
.suggest-action-row .suggest-preview:not([hidden]) { margin: 0; gap: 6px; align-items: center; }
.suggest-action-row .btn { flex: none; }
.method-detail { margin-top: 8px; border-top: 1px solid var(--line); }
.method-detail summary { min-height: 44px; display: flex; align-items: center; font-size: .75rem; cursor: pointer; color: var(--muted); }

/* Mobile UX R1: a photo workspace, with task context beside the actual image. */
:root { --r-ctl: 8px; --r-media: 16px; --shadow-stage: 0 1px 3px #15212d08,0 10px 30px #15212d06; }
h1,.intake h2 { font-weight: 760; letter-spacing: -.035em; }
.brand-name { letter-spacing: -.03em; }
.task-icon { width: 22px; height: 22px; flex: none; vertical-align: middle; }
.btn .task-icon { margin-right: 8px; }
.feature-number { display: flex; margin-bottom: 18px; }
.feature-number .task-icon { width: 28px; height: 28px; }
.hero h1 { font-size: clamp(2rem,4.5vw,3.35rem); line-height: 1.12; }
.hero-copy .lead { font-size: 1rem; }
.hero .demo-stage { border: 1px solid var(--line); box-shadow: none; }
.feature-card { border: 0; padding: 24px; box-shadow: 0 1px 0 var(--line); }
.dropzone { border: 1px solid var(--line); }
.mark-diagram { max-width: 28rem; margin-top: 24px; }
.mark-diagram img { display: block; width: 100%; height: auto; }
.mark-diagram p { font-size: .875rem; margin: 10px 0 4px; }
.mark-diagram small { font-size: .6875rem; color: var(--muted); }
.studio { grid-template-areas: "bar" "stage" "insp"; gap: 16px; }
.studio-bar { padding-bottom: 4px; }
.stage-panel { padding: 16px; border: 1px solid var(--line); box-shadow: none; }
.insp-title { font-size: 1.125rem; margin-bottom: 12px; }
.app h2[tabindex="-1"] { scroll-margin-top: max(12px,env(safe-area-inset-top)); }
@keyframes studio-fade { from { opacity: .5; } to { opacity: 1; } }
.studio [data-panel]:not([hidden]) { animation-name: studio-fade; }
.zone-switch { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.zone-button { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px; font-size: .8125rem; }
.zone-dot { width: 22px; height: 22px; background: none; color: var(--accent); border-radius: 0; }
.zone-1 { color: #8d591e; background: none; }.zone-2 { color: #78608c; background: none; }
.zone-state { max-width: none; text-align: left; }
.zone-button[aria-pressed="true"] { box-shadow: inset 0 -3px var(--accent); }
.protection-panel { margin-bottom: 12px; }.protection-panel .eyebrow { display: none; }
.protection-panel .fine { margin-bottom: 0; }
.status-msg { padding: 10px 0; margin-bottom: 8px; line-height: 1.45; }
.example-note { margin-bottom: 6px; }
.filmstrip .rail-title { font-size: .8125rem; font-weight: 650; color: var(--muted); margin: 12px 0 8px; }
.image-rail { display: flex; overflow-x: auto; overflow-y: hidden; gap: 12px; padding: 4px 0 8px; margin: 0; list-style: none; scroll-snap-type: x mandatory; scroll-padding-inline: 0; scrollbar-width: none; touch-action: pan-x pan-y; cursor: grab; }
.image-rail::-webkit-scrollbar { display: none; }
.image-rail > * { flex: 0 0 min(86%,340px); min-width: 0; margin: 0; scroll-snap-align: start; scroll-snap-stop: normal; }
.image-rail[data-dragging="true"] { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.pv { padding: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; }
.pv[data-output="true"] { border-color: var(--accent); }
.pv-frame { height: clamp(230px,38vh,330px); border-radius: 8px; padding: 6px; }
.pv figcaption { font-size: .8125rem; gap: 4px 8px; padding: 4px; }
.pv:not([data-output="true"]) .pv-kind { display: block; }
.app[data-preview-interaction="browse"] .pv canvas { cursor: grab; touch-action: pan-x pan-y; }
.app[data-preview-interaction="position"] .pv[data-output="true"] canvas { cursor: move; touch-action: none; outline: 2px solid var(--accent); outline-offset: 2px; }
.preview-actions { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 4px; }
#preview-position[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.rail-navigation { display: flex; justify-content: center; align-items: center; margin: 0; min-height: 44px; gap: 0; }
.rail-navigation button { width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; cursor: pointer; padding: 0; border-radius: 8px; }
.rail-navigation button span { width: 6px; height: 6px; border-radius: 50%; background: #718294; transition: width .16s,background .16s; }
.rail-navigation button[aria-current="true"] span { width: 20px; border-radius: 4px; background: var(--accent); }
.rail-count { font-size: .6875rem; color: var(--muted); margin-left: 8px; font-variant-numeric: tabular-nums; }
.shelf-cards { background: none; }
.shelf-cards > figure { flex-basis: auto; background: var(--paper-2); min-width: 136px; }
.set-stage-cards { gap: 12px; }
.set-stage-cards figure { display: flex; flex-direction: column; align-items: center; padding: 12px; border: 1px solid var(--line); background: var(--paper-2); border-radius: 12px; }
.set-stage-cards canvas { max-width: 100%; height: auto; }
.set-stage-cards figcaption { display: grid; gap: 4px; font-size: .8125rem; color: var(--ink); width: 100%; text-align: left; }
.set-stage-cards figcaption small { font-size: .75rem; color: var(--ok); }
#overview { margin-top: 0; padding-block: 8px; }
#loss-detail { padding-block: 8px; margin-top: 12px; }
.loss-review { margin-top: 8px; }.loss-review h3 { display: none; }
.savebar { background: #ffffffef; backdrop-filter: blur(12px); padding-bottom: max(8px,env(safe-area-inset-bottom)); }
.inspector { padding: 0 4px; }
.suggest { background: var(--surface); }.suggest[data-kind="suggest"] { background: var(--accent-soft); }
@media(min-width:1024px){
 .studio,.app[data-step="save"][data-export-mode="set"] .studio { grid-template-columns: minmax(0,1fr) 21rem; grid-template-areas: "bar bar" "stage insp"; align-items: start; }
 .image-rail > .pv { flex-basis: min(70%,280px); }
 .pv-frame { height: 240px; }.stage-panel { padding: 20px; }
 .inspector { padding: 8px 0; }
 .zone-button { flex-direction: row; align-items: center; }.zone-state { margin-left: auto; }
}
@media(max-width:600px){
 .app { padding-inline: 12px; }.studio { gap: 12px; }
 .site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
 .studio-actions { gap: 4px; }.studio-actions #style-shortcut { flex: 1; }
 .stage-panel { padding: 10px; border-radius: 12px; }
 .view-toggle { margin-bottom: 8px; }.view-toggle .seg-btn { font-size: .75rem; min-height: 44px; }
 .preview-actions { display: grid; grid-template-columns: 1fr; }
 #preview-numeric { justify-content: flex-start; }
 .pv-frame { height: min(300px,36vh); min-height: 220px; }
 .sim-note,#preview-mode-help { font-size: .6875rem; line-height: 1.5; }
 .tool-row { gap: 4px; }.tool-row .zoom { margin-left: 0; }
 .cmp-frame { height: 240px; }
 .hero { padding-block: 24px 32px; }.hero h1 { letter-spacing: -.045em; }
 .feature-card { padding: 20px; }.feature-visual { height: 180px; }
 .dropzone { padding: 20px; }.intake { padding-top: 20px; }
}
