/* Online editor — same colour chapters as the home page (home.css supplies the tokens, the nav,
   the FAQ bands, the step bar and the footer; the body carries both .editor-page and .home).
   The tool sits on the night field like prints on a light table, under the page's one loud
   element: today's date in a film camera's orange seven-segment imprint. No gradients, no
   rules, no shadows on things at rest, no monospace. */

.editor-page {
  --panel-w: 372px;
  --well: rgba(255, 255, 255, 0.06);       /* one tone step up from night */
  --well-2: rgba(255, 255, 255, 0.11);
}

/* ---------- The band: night ---------- */
.editor-page main > section.ed-band {
  /* Dark tokens for everything inside, so the panel and controls flip without extra rules. */
  --bg: var(--night);
  --surface: #13213A;
  --text: #EAF0F7;
  --text-soft: #B3C0D2;
  --line: rgba(255, 255, 255, 0.14);
  --link: #8DB8FF;
  padding: clamp(32px, 4.5vw, 72px) var(--frame) clamp(48px, 6vw, 88px);
  color: var(--text); background: var(--night);
}

.ed-intro {
  max-width: var(--wide); margin: 0 auto clamp(28px, 3.4vw, 48px);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 32px;
}
.ed-intro h1 {
  font: 800 var(--t-display)/0.94 var(--font-display);
  letter-spacing: -0.04em; color: #fff; font-variation-settings: "opsz" 96;
}
.ed-lede { margin-top: 24px; max-width: 44ch; font-size: var(--t-lead); line-height: 1.5; color: var(--text); }

/* ---------- Signature: the film-camera imprint ---------- */
.imprint-fig { margin: 0; display: grid; justify-items: end; gap: 12px; padding-bottom: 6px; }
.imprint svg { display: block; height: clamp(58px, 7.6vw, 112px); width: auto; overflow: visible; }
.imprint .on { fill: var(--imprint); }
.imprint .off { fill: rgba(255, 255, 255, 0.05); }
.imprint .is-burning .on { animation: burn 1.1s both; animation-delay: calc(var(--i) * 26ms + 150ms); }
@keyframes burn { 0% { opacity: 0; } 28% { opacity: 1; } 36% { opacity: 0.2; } 44% { opacity: 1; } 100% { opacity: 1; } }
.imprint-fig figcaption { font-size: var(--t-small); color: var(--text-soft); text-align: right; }

/* ---------- Workspace ---------- */
.ed {
  max-width: var(--wide); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w); gap: 8px; align-items: start;
}

/* The light table: one flat step lighter than the night. */
.ed-stage {
  position: relative; min-height: min(70vh, 740px);
  display: grid; place-items: center; padding: clamp(18px, 2.4vw, 40px);
  border-radius: 4px; background: var(--well); overflow: hidden;
}

/* The photo as a print: a white border. */
.ed-canvas {
  position: relative; z-index: 1; display: block; max-width: 100%;
  outline: clamp(5px, 0.55vw, 9px) solid #FAFAF8;
}

/* Before a photo: the open card sits over the sample's sky. */
.ed-drop {
  position: absolute; z-index: 3; top: clamp(56px, 9%, 96px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  display: grid; justify-items: center; gap: 14px; padding: 22px 26px 20px;
  text-align: center; color: #fff; border-radius: 16px; background: rgba(11, 22, 38, 0.92);
  animation: rise 0.6s 0.25s both cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ed-drop[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.ed-drop-title { font: 800 var(--t-h3)/1.1 var(--font-display); letter-spacing: -0.02em; }
.ed-drop-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ed-drop-sub { font-size: var(--t-small); color: var(--text-soft); }
.ed-file-btn { cursor: pointer; }
.ed-file-btn:focus-within { outline: 3px solid #fff; outline-offset: 3px; }
.ed-btn-glass { background: var(--well-2); color: #fff; }
.ed-btn-glass:hover { background: rgba(255, 255, 255, 0.18); }

/* Which style the tour is showing. */
.ed-demo-chip {
  position: absolute; z-index: 2; left: clamp(18px, 2.4vw, 40px); bottom: 14px; margin: 0;
  display: flex; gap: 8px; align-items: center; font-size: var(--t-small); font-weight: 600; color: #fff;
}
.ed-demo-chip:empty { display: none; }
.ed-demo-chip span { padding: 7px 12px; border-radius: 999px; background: rgba(11, 22, 38, 0.85); }
.ed-demo-chip em { font-style: normal; padding: 7px 12px; border-radius: 999px; background: var(--hivis); color: var(--night); }

/* Holding a file over the page. */
.ed-dropzone-hint {
  position: absolute; z-index: 4; inset: 12px; display: grid; place-items: center;
  outline: 3px solid var(--hivis); outline-offset: -3px; border-radius: 4px;
  background: rgba(11, 22, 38, 0.8);
  font: 800 var(--t-h2)/1 var(--font-display); color: #fff; letter-spacing: -0.03em;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.15s ease, visibility 0s 0.15s;
}
.ed-stage.is-dragging .ed-dropzone-hint { opacity: 1; visibility: visible; transition: opacity 0.15s ease; }

.ed-status {
  position: absolute; z-index: 5; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0;
  max-width: calc(100% - 32px); border-radius: 999px;
  font-size: var(--t-small); font-weight: 600; text-align: center; color: #fff; background: rgba(11, 22, 38, 0.92);
}
.ed-status:not(:empty) { padding: 8px 16px; }
.ed-status[data-kind="error"] { background: #9B1C1C; }
.ed-status[data-kind="success"] { background: #11643A; }
.ed-noscript { position: relative; z-index: 3; color: #EAF0F7; }

/* ---------- Panel: the same step as the table, groups split by space ---------- */
.ed-panel {
  position: sticky; top: 76px;
  max-height: calc(100vh - 92px); overflow: auto; overscroll-behavior: contain;
  padding: 6px 20px 20px; border-radius: 4px; background: var(--well);
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.ed-group { border: 0; margin: 0; padding: 16px 0 6px; min-width: 0; }
.ed-group[hidden] { display: none; }
.ed-group legend { float: left; width: 100%; margin-bottom: 10px; padding: 0; font-size: var(--t-small); font-weight: 700; color: #fff; }
.ed-group legend + * { clear: both; }
.ed-hint { margin-top: 10px; font-size: var(--t-small); line-height: 1.45; color: var(--text-soft); }

.ed-tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px; vertical-align: 1px;
  font: 700 0.8125rem/1.3 var(--font-body); background: var(--hivis); color: var(--night);
}

/* Styles: live swatches drawn by the stamp renderer. */
.ed-styles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ed-style { position: relative; cursor: pointer; }
.ed-style input { position: absolute; opacity: 0; pointer-events: none; }
.ed-style-face {
  display: grid; gap: 6px; justify-items: center; padding: 4px 4px 8px; border-radius: 10px;
  text-align: center; transition: background 0.15s ease, transform 0.15s ease;
}
.ed-style-swatch { width: 100%; aspect-ratio: 84 / 48; height: auto; border-radius: 6px; display: block; }
.ed-style-name { font-size: 0.8125rem; font-weight: 600; line-height: 1.15; color: var(--text-soft); }
/* On a swatch the iPhone tag is a yellow dot (its text stays for screen readers); the hint explains it. */
.ed-style .ed-tag { position: absolute; top: 8px; right: 8px; width: 11px; height: 11px; padding: 0; border-radius: 50%; overflow: hidden; color: transparent; font-size: 0.8125rem; outline: 2px solid var(--night); }
.ed-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--hivis); vertical-align: 0; }
.ed-style:hover .ed-style-face { background: var(--well); }
.ed-style:active .ed-style-face { transform: scale(0.96); }
.ed-style input:checked + .ed-style-face { background: var(--well-2); outline: 2px solid var(--hivis); outline-offset: -2px; }
.ed-style input:checked + .ed-style-face .ed-style-name { color: #fff; }
.ed-style input:focus-visible + .ed-style-face { outline: 3px solid #fff; outline-offset: 2px; }

/* 3×3 position grid as a little print. */
.ed-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 138px; padding: 6px; border-radius: 6px; background: var(--well); }
.ed-cell { cursor: pointer; display: grid; }
.ed-cell input { position: absolute; opacity: 0; pointer-events: none; }
.ed-cell span { height: 30px; border-radius: 4px; background: var(--well); display: grid; place-items: center; transition: background 0.15s ease; }
.ed-cell span::after { content: ""; width: 14px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.22); }
.ed-cell:hover span { background: var(--well-2); }
.ed-cell input:checked + span { background: rgba(255, 138, 31, 0.22); }
.ed-cell input:checked + span::after { background: var(--imprint); }
.ed-cell input:focus-visible + span { outline: 3px solid #fff; outline-offset: 2px; }

/* Segmented controls. */
.ed-seg { display: flex; padding: 3px; gap: 3px; border-radius: 12px; background: var(--well); }
.ed-seg label { flex: 1; cursor: pointer; display: grid; min-width: 0; }
.ed-seg input { position: absolute; opacity: 0; pointer-events: none; }
.ed-seg span {
  display: grid; place-items: center; min-height: 38px; padding: 0 8px; border-radius: 9px;
  font-size: var(--t-small); font-weight: 600; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background 0.15s ease, color 0.15s ease;
}
.ed-seg label:hover span { color: #fff; }
.ed-seg input:checked + span { background: #fff; color: var(--night); }
.ed-seg input:focus-visible + span { outline: 3px solid #fff; outline-offset: 1px; }
.ed-range { width: 100%; margin-top: 12px; accent-color: var(--hivis); }
.ed-range[hidden] { display: none; }

.ed-switch { display: flex; align-items: center; gap: 10px; min-height: 40px; margin-top: 6px; cursor: pointer; font-size: var(--t-small); }
.ed-switch[hidden] { display: none; }
.ed-switch input { width: 18px; height: 18px; accent-color: var(--hivis); flex: none; }
.ed-switch input:disabled + span { color: var(--text-soft); }

.ed-field { display: grid; gap: 6px; margin-top: 8px; }
.ed-field-label { font-size: var(--t-small); color: var(--text-soft); }
.ed-field-label.is-warning { color: var(--hivis); }
.ed-field input {
  min-height: 44px; padding: 0 12px; border-radius: 10px; font: inherit; font-size: var(--t-small);
  color: var(--text); background: var(--well); border: 1px solid var(--line); color-scheme: dark;
}

.ed-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-colors.is-disabled { opacity: 0.35; }
.ed-color { cursor: pointer; display: grid; }
.ed-color input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.ed-color span { width: 30px; height: 30px; border-radius: 50%; background: var(--c); outline: 2px solid rgba(255, 255, 255, 0.18); outline-offset: -2px; }
.ed-color input:checked + span { outline: 3px solid var(--hivis); outline-offset: 2px; }
.ed-color input:focus-visible + span { outline: 3px solid #fff; outline-offset: 3px; }
/* The "any colour" picker: a colour wheel is the picker's own face, not decoration. */
.ed-color-custom span { background: conic-gradient(#ff3b30, #ffd60a, #34c759, #0a84ff, #bf5af2, #ff3b30); } /* taste-skill-ignore */

.ed-actions { display: grid; gap: 10px; padding-top: 18px; }
.ed-save { width: 100%; min-height: 56px; }
.ed-save.is-iphone { background: #fff; color: var(--night); }
.ed-panel .btn-ghost { color: #fff; border: 0; background: var(--well-2); }
.ed-actions .btn-ghost[hidden] { display: none; }
.ed-save-note { font-size: var(--t-small); color: var(--text-soft); text-align: center; line-height: 1.4; }

/* What happens to the photo: three plain facts under the tool. */
.ed-facts {
  max-width: var(--wide); margin: 24px auto 0; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 32px;
  font-size: var(--t-small); color: var(--text);
}
.ed-facts li { display: flex; align-items: center; gap: 10px; }
.ed-facts li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--hivis); }

/* ---------- Continue on iPhone (a dialog, so it floats with a shadow) ---------- */
.ed-dialog {
  width: min(760px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px;
  background: #fff; color: var(--night);
  box-shadow: 0 30px 80px rgba(8, 20, 38, 0.35); /* taste-skill-ignore: a dialog floats */
}
.ed-dialog::backdrop { background: rgba(8, 20, 38, 0.7); }
.ed-dialog-close-form { position: absolute; top: 8px; right: 8px; margin: 0; }
.ed-dialog-close {
  width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--night); font-size: 1.75rem; line-height: 1;
}
.ed-dialog-close:hover { background: var(--paper); }
.ed-dialog-body { display: grid; grid-template-columns: 220px 1fr; gap: 28px; padding: 32px; align-items: center; }
.ed-qr-wrap { display: grid; gap: 8px; justify-items: center; }
.ed-qr { width: 200px; padding: 10px; border-radius: 12px; background: #fff; outline: 2px solid var(--paper); }
.ed-qr svg { display: block; width: 100%; height: auto; }
.ed-qr-cap { font-size: var(--t-small); color: #46556B; }
.ed-dialog-status { font-size: var(--t-body); font-weight: 700; color: #11643A; }
.ed-dialog h2 { margin: 12px 0 14px; font-size: clamp(1.5rem, 2.4vw, 1.875rem); line-height: 1.1; letter-spacing: -0.025em; }
.ed-benefits { margin: 0 0 20px; padding-left: 18px; font-size: var(--t-body); display: grid; gap: 6px; }
.ed-dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-dialog .btn-ink { background: var(--night); color: #fff; }
.ed-dialog .btn-ghost { border: 0; background: var(--paper); color: var(--night); }
.ed-dialog-fine { margin-top: 12px; font-size: var(--t-small); color: #46556B; }

/* ---------- How: paper, the steps as one bar, the EXIF note on hi-vis ---------- */
.editor-page main > section.ed-how { background: var(--paper); }
.ed-how-inner {
  max-width: var(--wide); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr); gap: clamp(32px, 5vw, 88px); align-items: start;
}
.ed-how h2 { font-size: var(--t-h2); line-height: 1.02; letter-spacing: -0.035em; max-width: 16ch; text-wrap: balance; }
.ed-bar .ed-bar-date .hm-bar-seg { background: var(--night); color: #fff; min-height: 96px; }
.ed-bar .hm-bar-pick .hm-bar-seg { min-height: 96px; }
.ed-bar .hm-bar-style .hm-bar-seg { min-height: 170px; }
.ed-bar .hm-bar-save .hm-bar-seg { min-height: 96px; }
.ed-exif { position: sticky; top: 96px; padding: clamp(28px, 3vw, 44px); border-radius: 4px; background: var(--hivis); color: var(--night); }
.ed-exif h2 { font-size: clamp(1.625rem, 2.6vw, 2.25rem); line-height: 1.08; letter-spacing: -0.025em; }
.ed-exif p { margin-top: 16px; font-size: var(--t-body); line-height: 1.55; }
@media (max-width: 860px) {
  .ed-how-inner { grid-template-columns: 1fr; }
  .ed-exif { position: static; }
  .ed-bar .hm-bar-seg { min-height: 72px !important; }
}

/* ---------- The app: signal blue ---------- */
.editor-page main > section.ed-iphone { background: var(--blue); color: #fff; }
.ed-iphone-inner {
  max-width: var(--wide); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 40px clamp(40px, 6vw, 112px); align-items: start;
}
.ed-iphone h2 { font-size: var(--t-h2); line-height: 1.02; letter-spacing: -0.035em; max-width: 13ch; color: #fff; }
.ed-iphone-copy p { margin: 24px 0 32px; font-size: var(--t-lead); line-height: 1.5; max-width: 40ch; }
/* A real table: its rows keep their lines. */
.ed-compare { width: 100%; border-collapse: collapse; font-size: var(--t-body); }
.ed-compare th, .ed-compare td { padding: 16px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.28); text-align: left; vertical-align: top; }
.ed-compare thead th { font-size: var(--t-small); font-weight: 700; }
.ed-compare tbody th { font-weight: 500; }
.ed-compare td { white-space: nowrap; }
.ed-compare td:last-child { font-weight: 700; }
.ed-prints { max-width: var(--wide); margin: clamp(48px, 6vw, 88px) auto 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(12px, 1.4vw, 20px); }
.ed-prints li { display: grid; gap: 12px; }
.ed-prints img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 3px; outline: 8px solid #FBFCFD; outline-offset: -8px; transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ed-prints li:nth-child(odd) img { transform: rotate(-1.2deg); }
.ed-prints li:nth-child(even) img { transform: rotate(1deg); }
.ed-prints li:hover img { transform: rotate(0) translateY(-4px); }
.ed-prints span { font-size: var(--t-small); font-weight: 600; }
@media (max-width: 860px) { .ed-iphone-inner { grid-template-columns: 1fr; } .ed-prints { grid-template-columns: 1fr 1fr; } }

/* ---------- Smaller screens ---------- */
@media (max-width: 1080px) {
  .ed { grid-template-columns: 1fr; }
  .ed-panel { position: static; max-height: none; }
  .ed-styles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .ed-intro { grid-template-columns: 1fr; gap: 22px; }
  .ed-intro h1 { font-size: clamp(2.3rem, 10.6vw, 2.75rem); }
  .imprint-fig { justify-items: start; }
  .imprint-fig figcaption { text-align: left; }
  .ed-stage { min-height: 0; padding: 18px 14px; display: grid; gap: 16px; }
  .ed-drop { position: static; transform: none; width: auto; animation: none; }
  .ed-demo-chip { bottom: auto; top: 26px; left: 22px; }
  .ed-styles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ed-dialog-body { grid-template-columns: 1fr; padding: 28px 20px 22px; text-align: center; }
  .ed-qr-wrap { display: none; }
  .ed-benefits { text-align: left; }
  .ed-dialog-actions { justify-content: center; }
  .ed-compare td { white-space: normal; }
  .ed-compare th, .ed-compare td { padding: 12px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .imprint .is-burning .on, .ed-drop { animation: none; }
}
